Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,6 @@ import gradio as gr
|
|
2 |
from transformers import AutoImageProcessor, AutoModelForObjectDetection
|
3 |
import torch
|
4 |
from PIL import Image, ImageDraw
|
5 |
-
import matplotlib.pyplot as plt
|
6 |
import io
|
7 |
|
8 |
# โหลดโมเดลและตัวประมวลผล
|
@@ -45,11 +44,11 @@ def detect_objects(image):
|
|
45 |
# สร้างอินเตอร์เฟซด้วย Gradio
|
46 |
interface = gr.Interface(
|
47 |
fn=detect_objects,
|
48 |
-
inputs=gr.
|
49 |
-
outputs=gr.
|
50 |
title="Object Detection with Transformers",
|
51 |
description="Upload an image to detect objects using a fine-tuned Conditional-DETR model."
|
52 |
)
|
53 |
|
54 |
# เปิดใช้งานอินเตอร์เฟซ
|
55 |
-
interface.launch()
|
|
|
2 |
from transformers import AutoImageProcessor, AutoModelForObjectDetection
|
3 |
import torch
|
4 |
from PIL import Image, ImageDraw
|
|
|
5 |
import io
|
6 |
|
7 |
# โหลดโมเดลและตัวประมวลผล
|
|
|
44 |
# สร้างอินเตอร์เฟซด้วย Gradio
|
45 |
interface = gr.Interface(
|
46 |
fn=detect_objects,
|
47 |
+
inputs=gr.Image(type="pil"),
|
48 |
+
outputs=gr.Image(type="auto"),
|
49 |
title="Object Detection with Transformers",
|
50 |
description="Upload an image to detect objects using a fine-tuned Conditional-DETR model."
|
51 |
)
|
52 |
|
53 |
# เปิดใช้งานอินเตอร์เฟซ
|
54 |
+
interface.launch()
|