Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -93,7 +93,6 @@ def iob_to_label(label):
|
|
93 |
|
94 |
|
95 |
def process_image(image):
|
96 |
-
|
97 |
print(type(image))
|
98 |
width, height = image.size
|
99 |
|
@@ -120,6 +119,13 @@ def process_image(image):
|
|
120 |
predicted_label = iob_to_label(prediction)
|
121 |
draw.rectangle(box, outline=label2color[predicted_label])
|
122 |
draw.text((box[0]+10, box[1]-10), text=predicted_label, fill=label2color[predicted_label], font=font)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
|
124 |
return image
|
125 |
|
@@ -143,4 +149,4 @@ iface = gr.Interface(fn=process_image,
|
|
143 |
css=css,
|
144 |
analytics_enabled = True, enable_queue=True)
|
145 |
|
146 |
-
iface.launch(inline=False, share=False, debug=True)
|
|
|
93 |
|
94 |
|
95 |
def process_image(image):
|
|
|
96 |
print(type(image))
|
97 |
width, height = image.size
|
98 |
|
|
|
119 |
predicted_label = iob_to_label(prediction)
|
120 |
draw.rectangle(box, outline=label2color[predicted_label])
|
121 |
draw.text((box[0]+10, box[1]-10), text=predicted_label, fill=label2color[predicted_label], font=font)
|
122 |
+
|
123 |
+
# Print label and value
|
124 |
+
label_text = f"Label: {predicted_label}"
|
125 |
+
value_text = f"Value: {prediction}"
|
126 |
+
print(label_text)
|
127 |
+
print(value_text)
|
128 |
+
print("------")
|
129 |
|
130 |
return image
|
131 |
|
|
|
149 |
css=css,
|
150 |
analytics_enabled = True, enable_queue=True)
|
151 |
|
152 |
+
iface.launch(inline=False, share=False, debug=True)
|