Fauzan Ardhana commited on
Commit
ed70bf2
1 Parent(s): 204e492

Initial commit

Browse files
Files changed (2) hide show
  1. app.py +23 -0
  2. requirements.txt +2 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ pipeline = pipeline(
5
+ "image-classification", model="fauzanardh/anime-time-beit_classifier"
6
+ )
7
+
8
+
9
+ def classify_image(input_img):
10
+ data = pipeline(input_img, top_k=4)
11
+ out = {}
12
+ for d in data:
13
+ out[d["label"]] = d["score"]
14
+ return out
15
+
16
+
17
+ demo = gr.Interface(
18
+ fn=classify_image,
19
+ inputs=gr.Image(type="pil"),
20
+ outputs=gr.Label(label="Prediction"),
21
+ )
22
+
23
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ torch
2
+ transformers==4.34.0