deepsearch / app.py
suchith83's picture
initial commit with gradio app
d07654f
raw
history blame
1.22 kB
import gradio as gr
from research import research
from textblob import TextBlob
def research_query(query):
"""
Function to handle research queries through Gradio interface
Args:
text (str): The query to perform websearch and provide summary.
Returns:
text (str): A detailed summary on the query asked by perfoming web search.
"""
if not query.strip():
return "Please enter a valid query"
try:
result = research(query)
return result
except Exception as e:
return f"Error processing query: {str(e)}"
# Create Gradio interface
demo = gr.Interface(
fn=research_query,
inputs=gr.Textbox(
lines=3,
placeholder="Enter your research query here...",
label="Research Query"
),
outputs=gr.Textbox(
lines=10,
label="Research Results"
),
title="Research Assistant",
description="Enter a query to get detailed research results using ReAct agent.",
examples=[
["What are the latest developments in quantum computing?"],
["Explain the impact of artificial intelligence on healthcare"],
]
)
if __name__ == "__main__":
demo.launch(mcp_server=True)