Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,8 +27,6 @@ os.environ.setdefault("STREAMLIT_SERVER_HEADLESS", "true") # headless alwa
|
|
| 27 |
import matplotlib
|
| 28 |
matplotlib.use("Agg")
|
| 29 |
|
| 30 |
-
import streamlit as st
|
| 31 |
-
import matplotlib.pyplot as plt
|
| 32 |
|
| 33 |
# ================= CONFIG =================
|
| 34 |
DB_PATH = "/tmp/olist.sqlite"
|
|
@@ -55,6 +53,9 @@ logging.basicConfig(
|
|
| 55 |
logger = logging.getLogger(__name__)
|
| 56 |
logger.info("===== Application Startup (Olist) =====")
|
| 57 |
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
# ================= OPENAI CLIENT (v1) =================
|
| 60 |
|
|
@@ -633,9 +634,9 @@ with tab1:
|
|
| 633 |
logger.info("Inside Submit handler")
|
| 634 |
if st.button("Submit"):
|
| 635 |
if client is None:
|
| 636 |
-
|
| 637 |
-
|
| 638 |
-
|
| 639 |
if st.session_state.user_input.strip():
|
| 640 |
start_time = time.time()
|
| 641 |
current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
|
|
|
| 27 |
import matplotlib
|
| 28 |
matplotlib.use("Agg")
|
| 29 |
|
|
|
|
|
|
|
| 30 |
|
| 31 |
# ================= CONFIG =================
|
| 32 |
DB_PATH = "/tmp/olist.sqlite"
|
|
|
|
| 53 |
logger = logging.getLogger(__name__)
|
| 54 |
logger.info("===== Application Startup (Olist) =====")
|
| 55 |
|
| 56 |
+
import streamlit as st
|
| 57 |
+
import matplotlib.pyplot as plt
|
| 58 |
+
|
| 59 |
|
| 60 |
# ================= OPENAI CLIENT (v1) =================
|
| 61 |
|
|
|
|
| 634 |
logger.info("Inside Submit handler")
|
| 635 |
if st.button("Submit"):
|
| 636 |
if client is None:
|
| 637 |
+
logger.error("OPENAI_API_KEY is not set. Aborting Submit handler.")
|
| 638 |
+
st.error("OPENAI_API_KEY is not set (Spaces → Settings → Repository secrets).")
|
| 639 |
+
st.stop()
|
| 640 |
if st.session_state.user_input.strip():
|
| 641 |
start_time = time.time()
|
| 642 |
current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|