Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -19,9 +19,11 @@ def predict(image, threshold=0.25, model_id=None):
|
|
19 |
global current_model_id
|
20 |
global model
|
21 |
if model_id != current_model_id:
|
|
|
|
|
22 |
current_model_id = model_id
|
23 |
-
|
24 |
-
#get model input size
|
25 |
config_path = hf_hub_download(repo_id=model_id, filename="config.json")
|
26 |
with open(config_path, "r") as f:
|
27 |
config = json.load(f)
|
@@ -45,5 +47,5 @@ gr.Interface(
|
|
45 |
],
|
46 |
outputs=gr.Image(type="pil"),
|
47 |
examples=examples,
|
48 |
-
cache_examples=True if examples else
|
49 |
).launch(enable_queue=True)
|
|
|
19 |
global current_model_id
|
20 |
global model
|
21 |
if model_id != current_model_id:
|
22 |
+
model = yolov5.load(model_id)
|
23 |
+
# model_yolov8 = YOLO(DEFAULT_DET_MODEL_ID_yolov8)
|
24 |
current_model_id = model_id
|
25 |
+
|
26 |
+
# get model input size
|
27 |
config_path = hf_hub_download(repo_id=model_id, filename="config.json")
|
28 |
with open(config_path, "r") as f:
|
29 |
config = json.load(f)
|
|
|
47 |
],
|
48 |
outputs=gr.Image(type="pil"),
|
49 |
examples=examples,
|
50 |
+
cache_examples=True if examples else Fale,
|
51 |
).launch(enable_queue=True)
|