Spaces:
Sleeping
Sleeping
Pawan Patil
commited on
Commit
·
99ea28d
1
Parent(s):
76c98ec
Add Gradio app initialization to app.py
Browse files
app.py
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from agent_app import ask_agent # Make sure this file exists in your repo
|
| 3 |
+
|
| 4 |
+
def chat_with_agent(prompt):
|
| 5 |
+
"""Handles user queries."""
|
| 6 |
+
try:
|
| 7 |
+
response = ask_agent(prompt)
|
| 8 |
+
return response
|
| 9 |
+
except Exception as e:
|
| 10 |
+
return f"⚠️ Error: {e}"
|
| 11 |
+
|
| 12 |
+
demo = gr.Interface(
|
| 13 |
+
fn=chat_with_agent,
|
| 14 |
+
inputs=gr.Textbox(label="Ask your Google Sheet Agent", placeholder="e.g., Show me engineers' average MTTR by manager"),
|
| 15 |
+
outputs=gr.Textbox(label="Agent Response"),
|
| 16 |
+
title="Google Sheet Agent",
|
| 17 |
+
description="An AI agent connected to Google Sheets to analyze data and generate summaries."
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
if __name__ == "__main__":
|
| 21 |
+
demo.launch()
|
| 22 |
+
|
| 23 |
+
|