davanstrien HF staff commited on
Commit
6935c2f
·
1 Parent(s): 1234ea9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -2
app.py CHANGED
@@ -1,4 +1,16 @@
1
  import gradio as gr
 
2
 
3
- gr.Interface.load(
4
- "flyswot/convnext-tiny-224_flyswot",src='huggingface',interpretation="shap").launch()
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ from transformers import pipeline
3
 
4
+ pipe = pipeline("image-classification", model="flyswot/convnext-tiny-224_flyswot")
5
+
6
+
7
+ def predict(image):
8
+ predictions = pipe(image)
9
+ return {pred['label']: pred['score'] for pred in predictions}
10
+
11
+ iface = gr.Interface(
12
+ fn=predict,
13
+ inputs=gr.inputs.Image(type='filepath'),
14
+ outputs='label', interpretation='shap',num_shap=3)
15
+
16
+ iface.launch()