Commit
·
049c207
1
Parent(s):
e13bdb6
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from predict import pre_process, predict
|
| 2 |
+
import gradio as gr
|
| 3 |
+
from PIL import Image
|
| 4 |
+
|
| 5 |
+
def predict_main(img_path):
|
| 6 |
+
image = Image.fromarray(img_path)
|
| 7 |
+
image = pre_process(image)
|
| 8 |
+
prediction = predict(image)
|
| 9 |
+
return prediction
|
| 10 |
+
|
| 11 |
+
demo = gr.Interface(fn=predict_main,
|
| 12 |
+
inputs=gr.Image(),
|
| 13 |
+
outputs=gr.Label(num_top_classes=3),
|
| 14 |
+
examples=[["0008_0002.JPG"]]
|
| 15 |
+
)
|
| 16 |
+
if __name__ == "__main__":
|
| 17 |
+
demo.launch()
|