Selcan Yukcu
commited on
Commit
·
b47bb6e
1
Parent(s):
6b3ee97
feat: new UI with history section
Browse files- gradio_app.py +24 -16
gradio_app.py
CHANGED
|
@@ -27,23 +27,31 @@ async def run_agent(request, history):
|
|
| 27 |
response, message = await lc_mcp_exec(request, history)
|
| 28 |
return response
|
| 29 |
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
),
|
| 37 |
-
outputs=gr.Markdown(
|
| 38 |
-
label="SQL Query / Result",
|
| 39 |
-
value="# Result \n \n",
|
| 40 |
-
# max_height=1500,
|
| 41 |
-
height= 1500
|
| 42 |
-
),
|
| 43 |
-
title="PostgreSQL Query Agent",
|
| 44 |
-
description="Ask your database in natural language and get results.",
|
| 45 |
-
flagging_mode="never"
|
| 46 |
)
|
| 47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
if __name__ == "__main__":
|
| 49 |
demo.launch()
|
|
|
|
| 27 |
response, message = await lc_mcp_exec(request, history)
|
| 28 |
return response
|
| 29 |
|
| 30 |
+
demo = gr.ChatInterface(
|
| 31 |
+
run_agent,
|
| 32 |
+
type="messages",
|
| 33 |
+
flagging_mode="manual",
|
| 34 |
+
flagging_options=["Like", "Spam", "Inappropriate", "Other"],
|
| 35 |
+
save_history=True,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
)
|
| 37 |
|
| 38 |
+
# Gradio UI
|
| 39 |
+
# demo = gr.Interface(
|
| 40 |
+
# fn=run_agent,
|
| 41 |
+
# inputs=gr.Textbox(
|
| 42 |
+
# label="Natural Language Request",
|
| 43 |
+
# placeholder="e.g., Show me the table of join posts and users tables."
|
| 44 |
+
# ),
|
| 45 |
+
# outputs=gr.Markdown(
|
| 46 |
+
# label="SQL Query / Result",
|
| 47 |
+
# value="# Result \n \n",
|
| 48 |
+
# # max_height=1500,
|
| 49 |
+
# height= 1500
|
| 50 |
+
# ),
|
| 51 |
+
# title="PostgreSQL Query Agent",
|
| 52 |
+
# description="Ask your database in natural language and get results.",
|
| 53 |
+
# flagging_mode="never"
|
| 54 |
+
# )
|
| 55 |
+
|
| 56 |
if __name__ == "__main__":
|
| 57 |
demo.launch()
|