Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,16 +3,11 @@ import os
|
|
| 3 |
import cv2
|
| 4 |
import numpy as np
|
| 5 |
import torch
|
| 6 |
-
import json
|
| 7 |
from PIL import Image
|
| 8 |
from transformers import CLIPProcessor, CLIPModel
|
| 9 |
from paddleocr import PaddleOCR
|
| 10 |
import tempfile
|
| 11 |
-
import spaces # Import
|
| 12 |
-
|
| 13 |
-
# Request H200 GPU for this Space
|
| 14 |
-
spaces.GPU.require("H200")
|
| 15 |
-
|
| 16 |
|
| 17 |
# ------------------------ Utility Functions ------------------------
|
| 18 |
|
|
@@ -118,7 +113,7 @@ candidates = [
|
|
| 118 |
|
| 119 |
# ------------------------ Main Processing Function ------------------------
|
| 120 |
|
| 121 |
-
@spaces.GPU
|
| 122 |
def process_image(image):
|
| 123 |
image_pil = Image.fromarray(image).convert("RGB")
|
| 124 |
img_path = "uploaded.jpg"
|
|
|
|
| 3 |
import cv2
|
| 4 |
import numpy as np
|
| 5 |
import torch
|
|
|
|
| 6 |
from PIL import Image
|
| 7 |
from transformers import CLIPProcessor, CLIPModel
|
| 8 |
from paddleocr import PaddleOCR
|
| 9 |
import tempfile
|
| 10 |
+
import spaces # Import for @spaces.GPU decorator
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
# ------------------------ Utility Functions ------------------------
|
| 13 |
|
|
|
|
| 113 |
|
| 114 |
# ------------------------ Main Processing Function ------------------------
|
| 115 |
|
| 116 |
+
@spaces.GPU()
|
| 117 |
def process_image(image):
|
| 118 |
image_pil = Image.fromarray(image).convert("RGB")
|
| 119 |
img_path = "uploaded.jpg"
|