syedizan commited on
Commit
b0c7d0e
1 Parent(s): 813163e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -1
app.py CHANGED
@@ -1,3 +1,19 @@
 
 
 
 
1
  import gradio as gr
 
 
 
 
 
 
 
2
 
3
- gr.Interface.load("models/meme-machines/autotrain-lolol-47324116463").launch()
 
 
 
 
 
 
1
+ #import gradio as gr
2
+
3
+ #gr.Interface.load("models/meme-machines/autotrain-lolol-47324116463").launch()
4
+
5
  import gradio as gr
6
+ from transformers import pipeline
7
+
8
+ pipeline = pipeline(task="image-classification", model="models/meme-machines/autotrain-lolol-47324116463")
9
+
10
+ def predict(image):
11
+ predictions = pipeline(image)
12
+ return {p["label"]: p["score"] for p in predictions}
13
 
14
+ gr.Interface(
15
+ predict,
16
+ inputs=gr.inputs.Image(label="Upload Dank Meme candidate", type="filepath"),
17
+ outputs=gr.outputs.Label(num_top_classes=2),
18
+ title="Dank Meme or Not?",
19
+ ).launch()