guru001's picture
coursera link updated
b3544d5
raw
history blame
1.23 kB
import numpy as np
import gradio as gr
from model import api
from PIL import Image
sign_api = api()
def sign(input_img):
input_img = Image.fromarray(input_img)
prediction = sign_api.predict(input_img)
print('prediction',prediction)
return prediction['class']
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"Signsapp"
description = r"""
<center>
Classify the signs based on the hands sign images
<img src="file/SIGNS.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=sign,
inputs = gr.Image(shape=(200, 200)),
outputs = gr.Label(),
examples=["two-fingers.jpg", "five-fingers.jpg", "four-fingers.jpg"]
# allow_flagging = "manual",
# flagging_options = ['recule', 'tournedroite', 'arretetoi', 'tournegauche', 'gauche', 'avance', 'droite'],
# flagging_dir = "./flag/men"
)
# demo.queue()
demo.launch(debug=True)