Spaces:
Running
on
Zero
Running
on
Zero
using zerogpu
Browse filesSigned-off-by: Zhang Jun <[email protected]>
- app.py +2 -0
- requirements.txt +1 -0
app.py
CHANGED
|
@@ -9,6 +9,7 @@ import os
|
|
| 9 |
# Set environment variable to avoid tokenizer parallelism deadlocks
|
| 10 |
os.environ["TOKENIZERS_PARALLELISM"] = "false"
|
| 11 |
|
|
|
|
| 12 |
from ocr_model import HunyuanOCR
|
| 13 |
from visualization import draw_detection_boxes, get_detection_summary
|
| 14 |
from dotenv import load_dotenv
|
|
@@ -56,6 +57,7 @@ def initialize_model():
|
|
| 56 |
return ocr_model
|
| 57 |
|
| 58 |
|
|
|
|
| 59 |
def process_image(image: Image.Image, prompt: str = None, target_language: str = "Chinese"):
|
| 60 |
"""
|
| 61 |
Process uploaded image and return annotated result
|
|
|
|
| 9 |
# Set environment variable to avoid tokenizer parallelism deadlocks
|
| 10 |
os.environ["TOKENIZERS_PARALLELISM"] = "false"
|
| 11 |
|
| 12 |
+
import spaces
|
| 13 |
from ocr_model import HunyuanOCR
|
| 14 |
from visualization import draw_detection_boxes, get_detection_summary
|
| 15 |
from dotenv import load_dotenv
|
|
|
|
| 57 |
return ocr_model
|
| 58 |
|
| 59 |
|
| 60 |
+
@spaces.GPU
|
| 61 |
def process_image(image: Image.Image, prompt: str = None, target_language: str = "Chinese"):
|
| 62 |
"""
|
| 63 |
Process uploaded image and return annotated result
|
requirements.txt
CHANGED
|
@@ -8,3 +8,4 @@ requests>=2.31.0
|
|
| 8 |
openai>=1.0.0
|
| 9 |
python-dotenv>=1.0.0
|
| 10 |
huggingface_hub>=0.19.0
|
|
|
|
|
|
| 8 |
openai>=1.0.0
|
| 9 |
python-dotenv>=1.0.0
|
| 10 |
huggingface_hub>=0.19.0
|
| 11 |
+
spaces>=0.30.0
|