MAPALO LUKASHI commited on
Commit ·
7075f98
1
Parent(s): a2dffa9
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,20 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
|
| 4 |
-
return "Hello " + name + "!!"
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
from fastai.vision.all import *
|
|
|
|
| 4 |
|
| 5 |
+
# Load the trained model
|
| 6 |
+
learn = load_learner('export.pkl')
|
| 7 |
+
|
| 8 |
+
# Define the classification function that Gradio will use
|
| 9 |
+
def classify_image(img):
|
| 10 |
+
pred, idx, probs = learn.predict(img)
|
| 11 |
+
# Assuming your model's predictions are 'T-shirt' and 'Trousers'
|
| 12 |
+
return {pred: max(probs.tolist())}
|
| 13 |
+
|
| 14 |
+
# Define the Gradio interface
|
| 15 |
+
# Create the interface
|
| 16 |
+
iface = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
| 17 |
+
|
| 18 |
+
# Launch the Gradio app
|
| 19 |
+
if __name__ == "__main__":
|
| 20 |
+
iface.launch()
|