Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,15 +1,24 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import pdfplumber
|
| 3 |
import logging
|
|
|
|
| 4 |
from llama_index.core import VectorStoreIndex
|
| 5 |
from langchain_community.vectorstores import FAISS
|
| 6 |
from langchain_community.embeddings import OpenAIEmbeddings
|
| 7 |
from langchain_community.chat_models import ChatOpenAI
|
| 8 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
|
|
|
| 9 |
|
| 10 |
# Suppress Streamlit warnings
|
| 11 |
logging.getLogger("streamlit").setLevel(logging.ERROR)
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
# Configure Streamlit app
|
| 14 |
st.set_page_config(page_title="📚 Curriculum Assistant", layout="wide")
|
| 15 |
st.title("📚 Curriculum Assistant for Teachers")
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import pdfplumber
|
| 3 |
import logging
|
| 4 |
+
import os
|
| 5 |
from llama_index.core import VectorStoreIndex
|
| 6 |
from langchain_community.vectorstores import FAISS
|
| 7 |
from langchain_community.embeddings import OpenAIEmbeddings
|
| 8 |
from langchain_community.chat_models import ChatOpenAI
|
| 9 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
| 10 |
+
from streamlit.runtime.scriptrunner import add_script_run_ctx, get_script_run_ctx
|
| 11 |
|
| 12 |
# Suppress Streamlit warnings
|
| 13 |
logging.getLogger("streamlit").setLevel(logging.ERROR)
|
| 14 |
|
| 15 |
+
# Ensure Streamlit runs in the correct execution context
|
| 16 |
+
ctx = get_script_run_ctx()
|
| 17 |
+
add_script_run_ctx(ctx)
|
| 18 |
+
|
| 19 |
+
# Explicitly set Streamlit UI mode to prevent bare mode issues
|
| 20 |
+
os.environ["STREAMLIT_SERVER_RUN_ON_SAVE"] = "true"
|
| 21 |
+
|
| 22 |
# Configure Streamlit app
|
| 23 |
st.set_page_config(page_title="📚 Curriculum Assistant", layout="wide")
|
| 24 |
st.title("📚 Curriculum Assistant for Teachers")
|