rogerscuall commited on
Commit
f71ec9b
·
verified ·
1 Parent(s): da2ae98

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +30 -14
app.py CHANGED
@@ -16,24 +16,40 @@ from chatbot import agent
16
 
17
 
18
  # Chat history to maintain conversation context
19
- def chatbot(message, history):
20
- # Get response from agent
 
 
 
 
 
 
 
 
21
  response = agent.run(message)
22
  return response
23
 
24
  # Create Gradio interface
25
- demo = gr.ChatInterface(
26
- fn=chatbot,
27
- title="Smol-Agent Chatbot",
28
- description="Ask me anything!",
29
- examples=[
30
- "What is machine learning?",
31
- "How does a transformer model work?",
32
- "Explain quantum computing in simple terms"
33
- ],
34
- theme=gr.themes.Soft()
35
- )
 
 
 
 
 
 
 
 
36
 
37
  # Launch the app
38
  if __name__ == "__main__":
39
- demo.launch(mcp_server=True)
 
16
 
17
 
18
  # Chat history to maintain conversation context
19
+ def relavant_info(message, history):
20
+ """
21
+ Relevant information for the user
22
+ Args:
23
+ message (str): The input text to search through
24
+ letter (str): The letter to search for
25
+
26
+ Returns:
27
+ str: The relevant information extracted from the message
28
+ """
29
  response = agent.run(message)
30
  return response
31
 
32
  # Create Gradio interface
33
+ # demo = gr.ChatInterface(
34
+ # fn=relavant_info,
35
+ # title="Smol-Agent Chatbot",
36
+ # description="Ask me anything!",
37
+ # examples=[
38
+ # "What is machine learning?",
39
+ # "How does a transformer model work?",
40
+ # "Explain quantum computing in simple terms"
41
+ # ],
42
+ # theme=gr.themes.Soft()
43
+ # )
44
+ with gr.Blocks(theme=gr.themes.Default(primary_hue="sky")) as ui:
45
+ gr.Markdown("# Deep Research")
46
+ query_textbox = gr.Textbox(label="What topic would you like to research?")
47
+ run_button = gr.Button("Run", variant="primary")
48
+ report = gr.Markdown(label="Report")
49
+
50
+ run_button.click(fn=relavant_info, inputs=query_textbox, outputs=report)
51
+ query_textbox.submit(fn=relavant_info, inputs=query_textbox, outputs=report)
52
 
53
  # Launch the app
54
  if __name__ == "__main__":
55
+ ui.launch(mcp_server=True)