Spaces:
Sleeping
Sleeping
Commit
·
6935c2f
1
Parent(s):
1234ea9
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,16 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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()
|