Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
-
import
|
4 |
from PIL import Image
|
5 |
# Images
|
6 |
torch.hub.download_url_to_file('https://cdn.pixabay.com/photo/2016/06/15/01/11/soccer-1457988_1280.jpg', 'soccer.jpg')
|
@@ -14,11 +14,13 @@ def yolo(im, size=640):
|
|
14 |
results.render() # updates results.imgs with boxes and labels
|
15 |
return Image.fromarray(results.imgs[0])
|
16 |
#inputs = gr.inputs.Image(type='pil', label="Original Image")
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
+
import time
|
4 |
from PIL import Image
|
5 |
# Images
|
6 |
torch.hub.download_url_to_file('https://cdn.pixabay.com/photo/2016/06/15/01/11/soccer-1457988_1280.jpg', 'soccer.jpg')
|
|
|
14 |
results.render() # updates results.imgs with boxes and labels
|
15 |
return Image.fromarray(results.imgs[0])
|
16 |
#inputs = gr.inputs.Image(type='pil', label="Original Image")
|
17 |
+
while True:
|
18 |
+
inputs=gr.inputs.Image(type="pil",source="webcam")
|
19 |
+
outputs = gr.outputs.Image(type="pil", label="Output Image")
|
20 |
+
title = "Определение элементов"
|
21 |
+
description = "Находит на картинке элементы"
|
22 |
+
article = "тест"
|
23 |
+
examples = [['soccer.jpg'], ['bus.jpg']]
|
24 |
+
gr.Interface(yolo, inputs, outputs, title=title, description=description, article=article, examples=examples, theme="huggingface").launch(
|
25 |
+
debug=True)
|
26 |
+
time.sleep(1)
|