jassi004 commited on
Commit
8847ce3
·
verified ·
1 Parent(s): 81917a3

Upload 2 files

Browse files
Files changed (2) hide show
  1. agent (2).py +10 -0
  2. main.py +22 -0
agent (2).py ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ from smol_agent import SmolAgent
2
+
3
+ # Define the agent with a set of useful tools
4
+ tools = ["search", "calculator", "python", "code"]
5
+ agent = SmolAgent(tools=tools)
6
+
7
+ def run_agent(question: str) -> str:
8
+ prompt = f"You are a helpful AI assistant. Answer the following question as clearly and accurately as possible:\n\n{question}"
9
+ response = agent.run(prompt)
10
+ return response
main.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from agent import run_agent
3
+
4
+ examples = [
5
+ "What's the capital of France?",
6
+ "Solve: 345 * 12",
7
+ "Write a Python function to reverse a list.",
8
+ "What's the square root of 169?",
9
+ "Who discovered penicillin?"
10
+ ]
11
+
12
+ def ask_agent(input_text):
13
+ return run_agent(input_text)
14
+
15
+ iface = gr.Interface(fn=ask_agent,
16
+ inputs="text",
17
+ outputs="text",
18
+ title="Final Assignment Agent",
19
+ description="Enter your question and the agent will answer it.",
20
+ examples=examples)
21
+
22
+ iface.launch()