Spaces:
Running
Running
Added new features to improve performance.
Browse files- app.py +16 -4
- indexer.py +7 -3
app.py
CHANGED
|
@@ -1,18 +1,30 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from indexer import run_email_agent
|
| 3 |
|
| 4 |
-
with gr.Blocks(
|
|
|
|
|
|
|
|
|
|
| 5 |
gr.Markdown("## Tool-Based AI Email Agent")
|
| 6 |
|
| 7 |
-
user_input = gr.Textbox(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
submit_btn = gr.Button("Run Agent")
|
| 9 |
|
| 10 |
-
output = gr.Textbox(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
human_box = gr.Textbox(
|
| 13 |
label="Human Assistance Required",
|
| 14 |
visible=False
|
| 15 |
)
|
|
|
|
| 16 |
def handle_query(text):
|
| 17 |
response = run_email_agent(text)
|
| 18 |
return response
|
|
@@ -23,4 +35,4 @@ with gr.Blocks() as demo:
|
|
| 23 |
outputs=output
|
| 24 |
)
|
| 25 |
|
| 26 |
-
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from indexer import run_email_agent
|
| 3 |
|
| 4 |
+
with gr.Blocks(css="""
|
| 5 |
+
body {background-color: #fffaf0;} /* Light creme background */
|
| 6 |
+
.gr-textbox {min-height: 200px;} /* Make textboxes taller */
|
| 7 |
+
""") as demo:
|
| 8 |
gr.Markdown("## Tool-Based AI Email Agent")
|
| 9 |
|
| 10 |
+
user_input = gr.Textbox(
|
| 11 |
+
label="User Query",
|
| 12 |
+
placeholder="Type your question here...",
|
| 13 |
+
lines=4 # make input box slightly bigger
|
| 14 |
+
)
|
| 15 |
submit_btn = gr.Button("Run Agent")
|
| 16 |
|
| 17 |
+
output = gr.Textbox(
|
| 18 |
+
label="Agent Response",
|
| 19 |
+
placeholder="The agent will respond here...",
|
| 20 |
+
lines=10 # bigger response box
|
| 21 |
+
)
|
| 22 |
|
| 23 |
human_box = gr.Textbox(
|
| 24 |
label="Human Assistance Required",
|
| 25 |
visible=False
|
| 26 |
)
|
| 27 |
+
|
| 28 |
def handle_query(text):
|
| 29 |
response = run_email_agent(text)
|
| 30 |
return response
|
|
|
|
| 35 |
outputs=output
|
| 36 |
)
|
| 37 |
|
| 38 |
+
demo.launch()
|
indexer.py
CHANGED
|
@@ -100,12 +100,16 @@ graph_builder.add_node("tools", tool_node)
|
|
| 100 |
graph_builder.add_edge(START, "chatbot")
|
| 101 |
|
| 102 |
graph_builder.add_conditional_edges(
|
| 103 |
-
"chatbot",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
)
|
| 105 |
|
| 106 |
-
graph_builder.add_edge("tools","chatbot")
|
| 107 |
|
| 108 |
-
graph_builder.add_edge("chatbot"
|
| 109 |
|
| 110 |
graph=graph_builder.compile()
|
| 111 |
|
|
|
|
| 100 |
graph_builder.add_edge(START, "chatbot")
|
| 101 |
|
| 102 |
graph_builder.add_conditional_edges(
|
| 103 |
+
"chatbot",
|
| 104 |
+
tools_condition,
|
| 105 |
+
{
|
| 106 |
+
"tools": "tools",
|
| 107 |
+
"__end__": END
|
| 108 |
+
}
|
| 109 |
)
|
| 110 |
|
|
|
|
| 111 |
|
| 112 |
+
graph_builder.add_edge("tools","chatbot")
|
| 113 |
|
| 114 |
graph=graph_builder.compile()
|
| 115 |
|