LightRT commited on
Commit
029bf9e
·
verified ·
1 Parent(s): f334e2b

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +9 -2
src/streamlit_app.py CHANGED
@@ -1,6 +1,11 @@
1
  import streamlit as st
2
  import requests
3
  import uuid
 
 
 
 
 
4
 
5
  # 1. PAGE CONFIGURATION
6
  st.set_page_config(page_title="Text2SQL Agent", page_icon="🤖", layout="centered")
@@ -40,7 +45,8 @@ with st.sidebar:
40
  # (Check your FastAPI main.py to confirm this endpoint name!)
41
  response = requests.post(
42
  "https://lightrt-text2sql-backend.hf.space/upload_url",
43
- json=payload_data
 
44
  )
45
 
46
  if response.status_code == 200:
@@ -94,7 +100,8 @@ if st.session_state.is_db_connected:
94
  # Send the question to your LangGraph backend
95
  chat_response = requests.post(
96
  "https://lightrt-text2sql-backend.hf.space/chat",
97
- json=payload
 
98
  )
99
 
100
  if chat_response.status_code == 200:
 
1
  import streamlit as st
2
  import requests
3
  import uuid
4
+ import os
5
+
6
+ # Grab the token from Hugging Face secrets
7
+ HF_TOKEN = os.getenv("HF_TOKEN")
8
+ HEADERS = {"Authorization": f"Bearer {HF_TOKEN}"} if HF_TOKEN else {}
9
 
10
  # 1. PAGE CONFIGURATION
11
  st.set_page_config(page_title="Text2SQL Agent", page_icon="🤖", layout="centered")
 
45
  # (Check your FastAPI main.py to confirm this endpoint name!)
46
  response = requests.post(
47
  "https://lightrt-text2sql-backend.hf.space/upload_url",
48
+ json=payload_data,
49
+ headers=HEADERS
50
  )
51
 
52
  if response.status_code == 200:
 
100
  # Send the question to your LangGraph backend
101
  chat_response = requests.post(
102
  "https://lightrt-text2sql-backend.hf.space/chat",
103
+ json=payload,
104
+ headers=HEADERS
105
  )
106
 
107
  if chat_response.status_code == 200: