Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -200,14 +200,14 @@ def validate_pdf(pdf):
|
|
200 |
return "الملف صالح للدردشة", True
|
201 |
|
202 |
def upload_pdf(pdf_file):
|
203 |
-
global vectorstore, chain # Use global variables to store state
|
204 |
-
|
205 |
data = load_pdf(pdf_file)
|
206 |
vectorstore = prepare_vectorstore(data)
|
207 |
chain = create_chain(vectorstore)
|
208 |
return "تم تحميل الملف بنجاح !", True
|
209 |
|
210 |
-
|
211 |
def chat(user_input):
|
212 |
global chain chat_history # Access the global chain variable
|
213 |
|
|
|
200 |
return "الملف صالح للدردشة", True
|
201 |
|
202 |
def upload_pdf(pdf_file):
|
203 |
+
global vectorstore, chain,chat_history # Use global variables to store state
|
204 |
+
chat_history = []
|
205 |
data = load_pdf(pdf_file)
|
206 |
vectorstore = prepare_vectorstore(data)
|
207 |
chain = create_chain(vectorstore)
|
208 |
return "تم تحميل الملف بنجاح !", True
|
209 |
|
210 |
+
|
211 |
def chat(user_input):
|
212 |
global chain chat_history # Access the global chain variable
|
213 |
|