Spaces:
Sleeping
Sleeping
added gradio UI
Browse files
app.py
CHANGED
@@ -1,19 +1,18 @@
|
|
|
|
1 |
from smolagents import CodeAgent, HfApiModel
|
2 |
from retriever import guest_info_tool
|
3 |
|
4 |
-
#
|
5 |
model = HfApiModel()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
-
# Create Alfred, our gala agent, with the guest info tool
|
8 |
-
alfred = CodeAgent(
|
9 |
-
tools=[guest_info_tool],
|
10 |
-
model=model
|
11 |
-
)
|
12 |
|
13 |
-
# Example query Alfred might receive during the gala
|
14 |
-
if __name__ == "__main__":
|
15 |
-
question = "Tell me about our guest named 'Lady Ada Lovelace'."
|
16 |
-
response = alfred.run(question)
|
17 |
|
18 |
-
print("🎩 Alfred's Response:")
|
19 |
-
print(response)
|
|
|
1 |
+
import gradio as gr
|
2 |
from smolagents import CodeAgent, HfApiModel
|
3 |
from retriever import guest_info_tool
|
4 |
|
5 |
+
# Setup agent
|
6 |
model = HfApiModel()
|
7 |
+
alfred = CodeAgent(tools=[guest_info_tool], model=model)
|
8 |
+
|
9 |
+
# Gradio interface function
|
10 |
+
def ask_alfred(question):
|
11 |
+
return alfred.run(question)
|
12 |
+
|
13 |
+
# Gradio app
|
14 |
+
demo = gr.Interface(fn=ask_alfred, inputs="text", outputs="text", title="🎩 Alfred, Gala Assistant")
|
15 |
+
demo.launch()
|
16 |
|
|
|
|
|
|
|
|
|
|
|
17 |
|
|
|
|
|
|
|
|
|
18 |
|
|
|
|