File size: 455 Bytes
049c207
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from predict import pre_process, predict
import gradio as gr
from PIL import Image

def predict_main(img_path):
    image = Image.fromarray(img_path)
    image = pre_process(image)
    prediction = predict(image)
    return prediction

demo = gr.Interface(fn=predict_main,
             inputs=gr.Image(),
             outputs=gr.Label(num_top_classes=3),
             examples=[["0008_0002.JPG"]]
            )
if __name__ == "__main__":
    demo.launch()