Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -723,6 +723,11 @@ def process_uploaded_pdf(pdf_file, progress=gr.Progress()):
|
|
723 |
print(f"Created {len(document_chunks)} chunks")
|
724 |
|
725 |
show_results_tab = True
|
|
|
|
|
|
|
|
|
|
|
726 |
progress(1.0, desc="PDF processed successfully!")
|
727 |
return "✅ PDF processed successfully! Chatbot is ready in the Chat tab.", gr.Tabs(visible=True)
|
728 |
else:
|
|
|
723 |
print(f"Created {len(document_chunks)} chunks")
|
724 |
|
725 |
show_results_tab = True
|
726 |
+
|
727 |
+
# Clear GPU cache after PDF processing to free memory for voice model
|
728 |
+
if torch.cuda.is_available():
|
729 |
+
torch.cuda.empty_cache()
|
730 |
+
|
731 |
progress(1.0, desc="PDF processed successfully!")
|
732 |
return "✅ PDF processed successfully! Chatbot is ready in the Chat tab.", gr.Tabs(visible=True)
|
733 |
else:
|