Youssef-Okeil commited on
Commit
29193e8
·
1 Parent(s): e40ad0c

Add Application File

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -1,7 +1,13 @@
 
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
 
 
 
 
1
+ from fastai.vision.all import *
2
  import gradio as gr
3
 
 
 
4
 
5
+ model_inf=load_learner('export.pkl')
6
+
7
+ categories=('Art Deco','Byzantine','Gothic','Neoclassical')
8
+
9
+ def image_classifier(img):
10
+ pred,pred_idx,probs = model_inf.predict(img)
11
+ return dict(zip(categories,map(float,probs)))
12
+ examples_arch=['ArtDeco.jpg','Byzantine.jpg','Gothic.jpg','Neoclassical.jpg']
13
+ gr.Interface(fn=image_classifier, inputs=gr.inputs.Image(shape=(192, 192)), outputs=gr.outputs.Label(num_top_classes=4),examples=examples_arch).launch(share=True)