Taskify-AI / app.py
KrishnaHuYaar's picture
Update app.py
af0bfd8 verified
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()