LiveEvil commited on
Commit
b1543f6
·
1 Parent(s): 6278004

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -9
app.py CHANGED
@@ -1,12 +1,16 @@
1
  import gradio as gr
2
 
3
- def image_classifier(input):
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()