Spaces:
Sleeping
Sleeping
Aravinth Meganathan
commited on
Commit
·
e00f06c
1
Parent(s):
955b698
app
Browse files
app.py
CHANGED
@@ -1,28 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
-
|
3 |
-
|
4 |
-
import timm
|
5 |
-
learn = load_learner('/content/drive/MyDrive/Rice Category Prediction/export.pkl')
|
6 |
|
7 |
-
|
8 |
-
|
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()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|