Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -34,12 +34,9 @@ def detect_objects(image):
|
|
| 34 |
draw.rectangle(box, outline="red", width=3)
|
| 35 |
draw.text((box[0], box[1]), f"{label_name}: {round(score.item(), 3)}", fill="red")
|
| 36 |
|
| 37 |
-
#
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
output_image.seek(0)
|
| 41 |
-
|
| 42 |
-
return output_image
|
| 43 |
|
| 44 |
# สร้างอินเตอร์เฟซด้วย Gradio
|
| 45 |
interface = gr.Interface(
|
|
|
|
| 34 |
draw.rectangle(box, outline="red", width=3)
|
| 35 |
draw.text((box[0], box[1]), f"{label_name}: {round(score.item(), 3)}", fill="red")
|
| 36 |
|
| 37 |
+
# แปลงภาพกลับเป็นรูปแบบที่ Gradio สามารถแสดงได้
|
| 38 |
+
pil_image = Image.fromarray(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))
|
| 39 |
+
return pil_imag
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
# สร้างอินเตอร์เฟซด้วย Gradio
|
| 42 |
interface = gr.Interface(
|