not-lain commited on
Commit
009aa6f
1 Parent(s): c12229a

initial commit

Browse files
Files changed (2) hide show
  1. app.py +33 -0
  2. requirements.txt +3 -0
app.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ pipeline = pipeline(
5
+ "image-classification", model="p1atdev/siglip-tagger-test-3", trust_remote_code=True
6
+ )
7
+
8
+
9
+ def predict(input_img):
10
+ predictions = pipeline(
11
+ input_img,
12
+ threshold=0.5, # optional parameter defaults to 0
13
+ return_scores=False, # optional parameter defaults to False
14
+ )
15
+ return predictions
16
+
17
+
18
+ description = """
19
+ image annotation pipeline using [`p1atdev/siglip-tagger-test-3`](https://huggingface.co/p1atdev/siglip-tagger-test-3) model **( •̀ ω •́ )y**
20
+
21
+ shoutout to [@p1atdev](https://huggingface.co/p1atdev) for his awesome work **~(=^‥^)ノ**
22
+ """
23
+
24
+
25
+ app = gr.Interface(
26
+ predict,
27
+ inputs=gr.Image(label="add your image here"),
28
+ outputs=gr.Text(label="tags"),
29
+ title="Image Annotator",
30
+ description=description,
31
+ )
32
+
33
+ app.launch()
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ transformers
2
+ gradio
3
+ torch