Varun2007 commited on
Commit
47ea66a
·
1 Parent(s): 76e7276

Import spaces at the very top of app.py to prevent CUDA initialization error on Hugging Face Spaces

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -1,3 +1,9 @@
 
 
 
 
 
 
1
  """Production Document Question Answering (DQA) - Gradio Web Interface.
2
 
3
  Configured for native Hugging Face Spaces deployment.
 
1
+ # IMPORTANT: spaces must be imported at the very top for Hugging Face Spaces / ZeroGPU
2
+ try:
3
+ import spaces
4
+ except Exception:
5
+ pass
6
+
7
  """Production Document Question Answering (DQA) - Gradio Web Interface.
8
 
9
  Configured for native Hugging Face Spaces deployment.