File size: 1,230 Bytes
1f77b91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import numpy as np
import gradio as gr
from model import api
from PIL import Image
from yolo.model import *

model = yolo_model()

def predict(input_img):
    input_img = Image.fromarray(input_img)
    _, payload = model.predict(image)
    # print('prediction',prediction)
    return payload

css = ''

# with gr.Blocks(css=css) as demo:
#     gr.HTML("<h1><center>Signsapp: Classify the signs based on the hands sign images<center><h1>")
#     gr.Interface(sign,inputs=gr.Image(shape=(200, 200)), outputs=gr.Label())

title = r"yolov3"

description = r"""
<center>
Recognize common objects using the model
<img src="file/det_dog-cycle-car.png" width=350px>
</center>
"""
article = r"""
### Credits
- [Coursera](https://www.coursera.org/learn/convolutional-neural-networks/)
"""

demo = gr.Interface(
    title = title,
    description = description,
    article = article, 
    fn=predict,
    inputs = gr.Image(shape=(200, 200)),
    outputs = gr.Image(shape=(200, 200)),
    examples=["dog-cycle-car.png"]
    # allow_flagging = "manual",
    # flagging_options = ['recule', 'tournedroite', 'arretetoi', 'tournegauche', 'gauche', 'avance', 'droite'],
    # flagging_dir = "./flag/men"
)

# demo.queue()
demo.launch(debug=True)