| 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() |