Spaces:
Sleeping
Sleeping
File size: 1,186 Bytes
6acdf50 1645e94 af0bfd8 6acdf50 af0bfd8 6acdf50 af0bfd8 6acdf50 af0bfd8 6acdf50 af0bfd8 6acdf50 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | 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()
|