Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -37,7 +37,7 @@ def load_image_into_numpy_array(path):
|
|
37 |
return pil_image_as_numpy_array(image)
|
38 |
|
39 |
def load_model():
|
40 |
-
download_dir = snapshot_download()
|
41 |
saved_model_dir = os.path.join(download_dir, "saved_model.pb")
|
42 |
detection_model = tf.saved_model.load(saved_model_dir)
|
43 |
return detection_model
|
@@ -54,13 +54,12 @@ detection_model = load_model()
|
|
54 |
# predicted_img = predict(image_arr)
|
55 |
# predicted_img.save('predicted.jpg')
|
56 |
|
57 |
-
|
58 |
gr.Interface(fn=predict,
|
59 |
inputs=[gr.Image(type="pil",label="Input Image"),gr.Textbox(placeholder="0.50",label="Set the confidence threshold (0.00-1.00)")],
|
60 |
outputs=gr.Image(type="pil",label="Output Image"),
|
61 |
title="Cauliflower and Beetroot Detection",
|
62 |
description="Model: ssd_resnet50_v1_fpn_640x640_coco17_tpu-8",
|
63 |
-
theme=gr.themes.Soft(primary_hue="blue", secondary_hue="sky")
|
64 |
-
examples=[["test_samples/image489.png",0.55], ["test_samples/image825.png",0.55], ["test_samples/image833.png",0.55], ["test_samples/image846.png",0.55]]
|
65 |
).launch(share=True)
|
66 |
|
|
|
37 |
return pil_image_as_numpy_array(image)
|
38 |
|
39 |
def load_model():
|
40 |
+
download_dir = snapshot_download(REPO_ID)
|
41 |
saved_model_dir = os.path.join(download_dir, "saved_model.pb")
|
42 |
detection_model = tf.saved_model.load(saved_model_dir)
|
43 |
return detection_model
|
|
|
54 |
# predicted_img = predict(image_arr)
|
55 |
# predicted_img.save('predicted.jpg')
|
56 |
|
57 |
+
REPO_ID = "23A066X"
|
58 |
gr.Interface(fn=predict,
|
59 |
inputs=[gr.Image(type="pil",label="Input Image"),gr.Textbox(placeholder="0.50",label="Set the confidence threshold (0.00-1.00)")],
|
60 |
outputs=gr.Image(type="pil",label="Output Image"),
|
61 |
title="Cauliflower and Beetroot Detection",
|
62 |
description="Model: ssd_resnet50_v1_fpn_640x640_coco17_tpu-8",
|
63 |
+
theme=gr.themes.Soft(primary_hue="blue", secondary_hue="sky")
|
|
|
64 |
).launch(share=True)
|
65 |
|