Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,12 +1,16 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
return {'normal': 0.3, 'bullying': 0.7}
|
5 |
-
|
6 |
-
demo = gr.Interface.load(
|
7 |
-
"models/datasciencemmw/pickonai-best",
|
8 |
-
inputs="image",
|
9 |
-
output="label",
|
10 |
-
title="PickOnAI Demo")
|
11 |
-
demo.launch()
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
from transformers import pipeline
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
+
pipe = pipeline("image-classification", model="datasciencemmw/pickonai-best")
|
6 |
+
|
7 |
+
def predict(image):
|
8 |
+
return pipe(image)[0]["image_classification"]
|
9 |
+
|
10 |
+
iface = gr.Interface(
|
11 |
+
fn=predict,
|
12 |
+
inputs='image',
|
13 |
+
outputs='label',
|
14 |
+
)
|
15 |
+
|
16 |
+
iface.launch()
|