fix zero gpu
Browse files- app.py +2 -2
- test_rect.py +0 -2
app.py
CHANGED
@@ -13,9 +13,9 @@ from io import BytesIO
|
|
13 |
import logging
|
14 |
#logging.basicConfig(level=logging.DEBUG)
|
15 |
print("Loading model...")
|
16 |
-
|
|
|
17 |
def process_image(input_image:Image, meter_type:str):
|
18 |
-
fl, fl_ft = model_init(hack=False)
|
19 |
if meter_type == "方形儀表":
|
20 |
value, img = read_meter_rect(input_image, fl, fl_ft)
|
21 |
return img, f"辨識結果: PA={value}", None
|
|
|
13 |
import logging
|
14 |
#logging.basicConfig(level=logging.DEBUG)
|
15 |
print("Loading model...")
|
16 |
+
fl, fl_ft = model_init(hack=False)
|
17 |
+
@spaces.GPU(duration=30)
|
18 |
def process_image(input_image:Image, meter_type:str):
|
|
|
19 |
if meter_type == "方形儀表":
|
20 |
value, img = read_meter_rect(input_image, fl, fl_ft)
|
21 |
return img, f"辨識結果: PA={value}", None
|
test_rect.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
# %%
|
2 |
-
import spaces
|
3 |
import matplotlib.style
|
4 |
from transformers import AutoProcessor, AutoModelForCausalLM
|
5 |
from PIL import Image
|
@@ -126,7 +125,6 @@ def read_meter(img, fl:Florence, fl_ft:Florence):
|
|
126 |
|
127 |
|
128 |
|
129 |
-
@spaces.GPU
|
130 |
def main():
|
131 |
fl, fl_ft = model_init()
|
132 |
for img_fn in imgs:
|
|
|
1 |
# %%
|
|
|
2 |
import matplotlib.style
|
3 |
from transformers import AutoProcessor, AutoModelForCausalLM
|
4 |
from PIL import Image
|
|
|
125 |
|
126 |
|
127 |
|
|
|
128 |
def main():
|
129 |
fl, fl_ft = model_init()
|
130 |
for img_fn in imgs:
|