Mohammed Albrayh commited on
Commit
074c2ca
1 Parent(s): b320e82

add app file

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import pickle
3
+ from fastai.vision.all import *
4
+
5
+ #Windows fix
6
+ import pathlib
7
+ temp = pathlib.PosixPath
8
+ pathlib.PosixPath = pathlib.WindowsPath
9
+
10
+
11
+ learn = load_learner('model.pkl')
12
+
13
+ def predict(input):
14
+ image = PILImage.create(input).resize((182, 268))
15
+ # Use your model to make predictions on the input data
16
+ results = learn.predict(image)[0]
17
+ results = ', '.join(results)
18
+ return results
19
+
20
+
21
+ demo = gr.Interface(fn=predict, inputs="image",examples=['examples\Gun.jpg','examples\mario movie.jpg','examples\lalaLand.jpg'] ,outputs="text")
22
+ demo.launch()