-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfrontend.py
More file actions
31 lines (25 loc) · 809 Bytes
/
frontend.py
File metadata and controls
31 lines (25 loc) · 809 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import streamlit as st
import requests
st.set_page_config(page_title="Multi-Agent Assignment", page_icon="🤖")
st.title("🤖 Multi-Agent Assignment Frontend")
query = st.text_input("Ask your question:")
agent_type = st.radio(
"Choose the agent:",
("Support Agent", "Dashboard Agent")
)
if st.button("Submit") and query:
if agent_type == "Support Agent":
endpoint = "http://127.0.0.1:5000/support"
else:
endpoint = "http://127.0.0.1:5000/dashboard"
try:
response = requests.post(
endpoint,
json={"query": query}
)
response.raise_for_status()
result = response.json()
st.success("**Agent Response:**")
st.write(result.get("response"))
except Exception as e:
st.error(f"Error: {e}")