Amna2024 commited on
Commit
33bb7de
·
verified ·
1 Parent(s): 51b206c

Update streamlit_app.py

Browse files
Files changed (1) hide show
  1. streamlit_app.py +16 -16
streamlit_app.py CHANGED
@@ -1,8 +1,7 @@
1
  # streamlit_app.py
2
 
3
  import streamlit as st
4
- import requests
5
- import json
6
 
7
  # Set page configuration
8
  st.set_page_config(
@@ -16,22 +15,22 @@ st.title("Customer Support Assistant")
16
  st.markdown("Ask a question about technical issues, billing, or general inquiries.")
17
 
18
  # API endpoint (change this if your FastAPI app is running on a different address)
19
- API_URL = "http://127.0.0.1:8000/process"
20
  # "https://amna2024-customer-support-assistant.hf.space/process"
21
 
22
 
23
  # Create a function to call the API
24
- def process_query(query):
25
- try:
26
- response = requests.post(
27
- API_URL,
28
- json={"query": query},
29
- headers={"Content-Type": "application/json"},
30
- timeout=10
31
- )
32
- return response.json()
33
- except requests.exceptions.RequestException as e:
34
- return {"error": f"API request failed: {str(e)}"}
35
 
36
 
37
  # Create the main interface
@@ -46,8 +45,9 @@ if "conversation" not in st.session_state:
46
  if submit_button and query:
47
  with st.spinner("Processing your request..."):
48
  # Call the API
49
- result = process_query(query)
50
- st.write("🔧 Raw API response:", result) # 👈 Add this line for debugging
 
51
  if "error" in result:
52
  st.error(result["error"])
53
  else:
 
1
  # streamlit_app.py
2
 
3
  import streamlit as st
4
+ from Customer_Support.workflow import run_customer_support
 
5
 
6
  # Set page configuration
7
  st.set_page_config(
 
15
  st.markdown("Ask a question about technical issues, billing, or general inquiries.")
16
 
17
  # API endpoint (change this if your FastAPI app is running on a different address)
18
+ #API_URL = "http://127.0.0.1:8000/process"
19
  # "https://amna2024-customer-support-assistant.hf.space/process"
20
 
21
 
22
  # Create a function to call the API
23
+ #def process_query(query):
24
+ # try:
25
+ # response = requests.post(
26
+ # API_URL,
27
+ # json={"query": query},
28
+ # headers={"Content-Type": "application/json"},
29
+ # timeout=10
30
+ # )
31
+ # return response.json()
32
+ # except requests.exceptions.RequestException as e:
33
+ # return {"error": f"API request failed: {str(e)}"}
34
 
35
 
36
  # Create the main interface
 
45
  if submit_button and query:
46
  with st.spinner("Processing your request..."):
47
  # Call the API
48
+ #result = process_query(query)
49
+ result = run_customer_support(query)
50
+ st.write("🔧 Raw response:", result) # 👈 Add this line for debugging
51
  if "error" in result:
52
  st.error(result["error"])
53
  else: