Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from agent import handle_user_query
|
| 3 |
+
|
| 4 |
+
with gr.Blocks() as demo:
|
| 5 |
+
gr.Markdown("# ✨ Stellar Knowledge Agent\nAsk anything about Stellar, wallets, Horizon API, Soroban, and more!")
|
| 6 |
+
|
| 7 |
+
chatbot = gr.Chatbot(label="Stellar Assistant")
|
| 8 |
+
with gr.Row():
|
| 9 |
+
msg = gr.Textbox(label="Your question")
|
| 10 |
+
send_btn = gr.Button("Send")
|
| 11 |
+
|
| 12 |
+
def respond(history, user_message):
|
| 13 |
+
answer = handle_user_query(user_message)
|
| 14 |
+
history.append((user_message, answer))
|
| 15 |
+
return history, ""
|
| 16 |
+
|
| 17 |
+
send_btn.click(
|
| 18 |
+
respond,
|
| 19 |
+
inputs=[chatbot, msg],
|
| 20 |
+
outputs=[chatbot, msg]
|
| 21 |
+
)
|
| 22 |
+
|
| 23 |
+
if __name__ == "__main__":
|
| 24 |
+
demo.launch()
|