raksama19 commited on
Commit
e6110f1
·
verified ·
1 Parent(s): b665270

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -0
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: