Spaces:
Configuration error
Configuration error
Update app.py
Browse files
app.py
CHANGED
|
@@ -101,7 +101,7 @@ def prediction(image_path):
|
|
| 101 |
ax[1].imshow(image_np,aspect='auto');
|
| 102 |
|
| 103 |
|
| 104 |
-
return objects
|
| 105 |
|
| 106 |
|
| 107 |
|
|
@@ -110,7 +110,7 @@ def prediction(image_path):
|
|
| 110 |
model_PATH_TO_CKPT = "frozen_inference_graph.pb"
|
| 111 |
path_to_labels = "tf_label_map.pbtxt"
|
| 112 |
|
| 113 |
-
result = main(image_path,model_path,model_PATH_TO_CKPT,path_to_labels)
|
| 114 |
|
| 115 |
# print("result-",result)
|
| 116 |
# list_to_be_sorted= [{'class': 'Y', 'score': 99.97, 'box': (157, 191, 269, 288)}, {'class': '6', 'score': 99.93, 'box': (158, 191, 247, 267)}, {'class': '9', 'score': 99.88, 'box': (156, 190, 179, 196)}, {'class': '4', 'score': 99.8, 'box': (156, 189, 198, 219)}, {'class': '1', 'score': 99.65, 'box': (157, 189, 222, 244)}, {'class': 'F', 'score': 63.4, 'box': (155, 185, 157, 175)}]
|
|
@@ -129,7 +129,7 @@ def prediction(image_path):
|
|
| 129 |
response = {"predictions": [result]}
|
| 130 |
total_time_end = time.time()
|
| 131 |
print("total time : ",round((total_time_end-total_time_start),2))
|
| 132 |
-
return simplejson.dumps(response)
|
| 133 |
|
| 134 |
inputs = gr.inputs.Image(type = 'filepath')
|
| 135 |
EXAMPLES = ["img1.jpg","img2.jpg","img3.jpg","img4.jpg"]
|
|
@@ -141,7 +141,7 @@ DESCRIPTION = """An image is occluded if the image is blocked by any object.
|
|
| 141 |
demo_app = gr.Interface(
|
| 142 |
fn= prediction,
|
| 143 |
inputs=inputs,
|
| 144 |
-
outputs= "text",
|
| 145 |
title = "Tag Diciphering",
|
| 146 |
description = DESCRIPTION,
|
| 147 |
examples = EXAMPLES,
|
|
|
|
| 101 |
ax[1].imshow(image_np,aspect='auto');
|
| 102 |
|
| 103 |
|
| 104 |
+
return objects,fig
|
| 105 |
|
| 106 |
|
| 107 |
|
|
|
|
| 110 |
model_PATH_TO_CKPT = "frozen_inference_graph.pb"
|
| 111 |
path_to_labels = "tf_label_map.pbtxt"
|
| 112 |
|
| 113 |
+
result,fig = main(image_path,model_path,model_PATH_TO_CKPT,path_to_labels)
|
| 114 |
|
| 115 |
# print("result-",result)
|
| 116 |
# list_to_be_sorted= [{'class': 'Y', 'score': 99.97, 'box': (157, 191, 269, 288)}, {'class': '6', 'score': 99.93, 'box': (158, 191, 247, 267)}, {'class': '9', 'score': 99.88, 'box': (156, 190, 179, 196)}, {'class': '4', 'score': 99.8, 'box': (156, 189, 198, 219)}, {'class': '1', 'score': 99.65, 'box': (157, 189, 222, 244)}, {'class': 'F', 'score': 63.4, 'box': (155, 185, 157, 175)}]
|
|
|
|
| 129 |
response = {"predictions": [result]}
|
| 130 |
total_time_end = time.time()
|
| 131 |
print("total time : ",round((total_time_end-total_time_start),2))
|
| 132 |
+
return simplejson.dumps(response),fig
|
| 133 |
|
| 134 |
inputs = gr.inputs.Image(type = 'filepath')
|
| 135 |
EXAMPLES = ["img1.jpg","img2.jpg","img3.jpg","img4.jpg"]
|
|
|
|
| 141 |
demo_app = gr.Interface(
|
| 142 |
fn= prediction,
|
| 143 |
inputs=inputs,
|
| 144 |
+
outputs= ["text", "image"],
|
| 145 |
title = "Tag Diciphering",
|
| 146 |
description = DESCRIPTION,
|
| 147 |
examples = EXAMPLES,
|