Aravinth Meganathan commited on
Commit
e00f06c
·
1 Parent(s): 955b698
Files changed (1) hide show
  1. app.py +4 -26
app.py CHANGED
@@ -1,28 +1,6 @@
1
  import gradio as gr
2
- from fastai.vision.all import *
3
- import skimage
4
- import timm
5
- learn = load_learner('/content/drive/MyDrive/Rice Category Prediction/export.pkl')
6
 
7
- labels = learn.dls.vocab
8
- def predict(img):
9
- img = PILImage.create(img)
10
- pred,pred_idx,probs = learn.predict(img)
11
- return {labels[i]: float(probs[i]) for i in range(len(labels))}
12
-
13
- title = "Rice Category Classifier"
14
- description = "A pet breed classifier trained on the Oxford Pets dataset with fastai. Created as a demo for Gradio and HuggingFace Spaces."
15
- article="<p style='text-align: center'><a href='https://tmabraham.github.io/blog/gradio_hf_spaces_tutorial' target='_blank'>Blog post</a></p>"
16
- examples = ['/content/drive/MyDrive/Rice Category Prediction/Arborio.jpg',
17
- '/content/drive/MyDrive/Rice Category Prediction/Basmati.jpg',
18
- '/content/drive/MyDrive/Rice Category Prediction/Jasmine.jpg',
19
- '/content/drive/MyDrive/Rice Category Prediction/Ispala.jpg',
20
- '/content/drive/MyDrive/Rice Category Prediction/Karacadag.jpg'
21
-
22
- ]
23
- interpretation='default'
24
- enable_queue=True
25
-
26
- demo = gr.Interface(fn=predict, inputs="image", outputs="label",examples= examples)
27
- if __name__ == "__main__":
28
- demo.launch()
 
1
  import gradio as gr
2
+ def greet(name):
3
+ return "Hello " + name + "!!"
 
 
4
 
5
+ iface = gr.Interface(fn=greet, inputs="text", outputs="text")
6
+ iface.launch()