Spaces:
Sleeping
Sleeping
Update app.py
#1
by
2384603g
- opened
app.py
CHANGED
@@ -24,7 +24,9 @@ def process_image(pilimg):
|
|
24 |
# print(x.shape)
|
25 |
result = detection_model.predict(source, conf=0.5)
|
26 |
img_bgr = result[0].plot()
|
27 |
-
|
|
|
|
|
28 |
|
29 |
def process_video(video):
|
30 |
# Open the video file
|
@@ -72,7 +74,7 @@ message = "<h1>Welcome to the Image and Video Upload App For Violin & Guzheng!</
|
|
72 |
|
73 |
# Create the interface for image upload
|
74 |
image_interface = gr.Interface(fn=process_image,
|
75 |
-
inputs=gr.Image(label="Upload an Image"),
|
76 |
outputs="image")
|
77 |
|
78 |
# Create the interface for video upload
|
|
|
24 |
# print(x.shape)
|
25 |
result = detection_model.predict(source, conf=0.5)
|
26 |
img_bgr = result[0].plot()
|
27 |
+
out_pilimg = Image.fromarray(img_bgr[..., ::-1]) # RGB-order PIL image
|
28 |
+
|
29 |
+
return out_pilimg
|
30 |
|
31 |
def process_video(video):
|
32 |
# Open the video file
|
|
|
74 |
|
75 |
# Create the interface for image upload
|
76 |
image_interface = gr.Interface(fn=process_image,
|
77 |
+
inputs=gr.Image(label="Upload an Image", type="pil"),
|
78 |
outputs="image")
|
79 |
|
80 |
# Create the interface for video upload
|