nightprogrammer commited on
Commit
cb8398f
·
verified ·
1 Parent(s): 2c45ebf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -2,6 +2,7 @@ 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
@@ -63,4 +64,12 @@ if user_input:
63
  st.session_state["messages"].append(("Assistant", response))
64
 
65
  for role, msg in st.session_state["messages"]:
66
- st.chat_message(role).write(msg)
 
 
 
 
 
 
 
 
 
2
  import pdfplumber
3
  import logging
4
  import os
5
+ import threading
6
  from llama_index.core import VectorStoreIndex
7
  from langchain_community.vectorstores import FAISS
8
  from langchain_community.embeddings import OpenAIEmbeddings
 
64
  st.session_state["messages"].append(("Assistant", response))
65
 
66
  for role, msg in st.session_state["messages"]:
67
+ st.chat_message(role).write(msg)
68
+
69
+ # Check for multithreading issues
70
+ def check_multithreading():
71
+ """Ensures Streamlit functions run in the main thread"""
72
+ if threading.current_thread().name != "MainThread":
73
+ st.warning("⚠️ Streamlit functions should run in the main thread to avoid execution issues.")
74
+
75
+ check_multithreading()