Spaces:
Running
on
Zero
Running
on
Zero
zinojeng
commited on
Commit
·
f59f198
1
Parent(s):
cdc67a5
Fix module import path for Hugging Face Space
Browse filesChanges:
- Add try-except for import path resolution
- Try 'backend.process.image_process' first (HF Space structure)
- Fall back to 'process.image_process' (local deployment)
- Ensures compatibility with both environments
Fixes: No module named 'process' error on HF Space
app.py
CHANGED
|
@@ -22,7 +22,12 @@ def load_model():
|
|
| 22 |
global model, processor
|
| 23 |
if model is None:
|
| 24 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
model_path = "deepseek-ai/DeepSeek-OCR"
|
| 28 |
|
|
|
|
| 22 |
global model, processor
|
| 23 |
if model is None:
|
| 24 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 25 |
+
try:
|
| 26 |
+
# Try importing from backend.process first (for Hugging Face Space)
|
| 27 |
+
from backend.process.image_process import DeepseekOCRProcessor
|
| 28 |
+
except ImportError:
|
| 29 |
+
# Fall back to process.image_process (for local deployment)
|
| 30 |
+
from process.image_process import DeepseekOCRProcessor
|
| 31 |
|
| 32 |
model_path = "deepseek-ai/DeepSeek-OCR"
|
| 33 |
|