Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from llm import get_llm | |
| from prompt import task_prompt | |
| def analyze_text(input_text): | |
| try: | |
| if not input_text.strip(): | |
| return "β οΈ Please enter some text." | |
| llm = get_llm() | |
| chain = task_prompt | llm | |
| result = chain.invoke({"input_text": input_text}) | |
| return result.content | |
| except Exception as e: | |
| return f"β Error:\n{str(e)}" | |
| with gr.Blocks(css=""" | |
| #output { | |
| background-color: #f9fafb; | |
| border-radius: 10px; | |
| padding: 16px; | |
| } | |
| """) as demo: | |
| gr.Markdown( | |
| """ | |
| # π§ Taskify AI | |
| **Turn text into clear actions** | |
| """ | |
| ) | |
| gr.Markdown("Paste any text below and get a clear summary, tasks, and questions.") | |
| input_box = gr.Textbox( | |
| label="π₯ Paste your text", | |
| lines=10, | |
| placeholder="Paste notes, article, or explanation here..." | |
| ) | |
| analyze_btn = gr.Button("π Analyze", variant="primary") | |
| output_box = gr.Markdown( | |
| label="π€ AI Output", | |
| elem_id="output" | |
| ) | |
| analyze_btn.click( | |
| fn=analyze_text, | |
| inputs=input_box, | |
| outputs=output_box | |
| ) | |
| demo.launch() | |