Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,19 @@
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
gr.Interface
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# import gradio as gr
|
2 |
+
|
3 |
+
# gr.Interface.load("models/meme-machines/autotrain-lolool-fine-tuned-47546116529").launch()
|
4 |
+
|
5 |
import gradio as gr
|
6 |
+
from transformers import pipeline
|
7 |
+
|
8 |
+
pipeline = pipeline(task="image-classification", model="models/meme-machines/autotrain-lolool-fine-tuned-47546116529")
|
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()
|