Spaces:
Runtime error

MAPALO LUKASHI commited on
Commit
7075f98
·
1 Parent(s): a2dffa9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -4
app.py CHANGED
@@ -1,7 +1,20 @@
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
  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()