not-lain commited on
Commit
4c6aa6e
β€’
1 Parent(s): 009aa6f

add more functionalities

Browse files
Files changed (4) hide show
  1. README.md +1 -1
  2. app.py +8 -6
  3. lowres XD.jpg +0 -0
  4. pixeled lain.jpg +0 -0
README.md CHANGED
@@ -1,6 +1,6 @@
1
  ---
2
  title: SigLIP Tagger
3
- emoji: πŸ¦€
4
  colorFrom: blue
5
  colorTo: yellow
6
  sdk: gradio
 
1
  ---
2
  title: SigLIP Tagger
3
+ emoji: 🌘WπŸŒ–
4
  colorFrom: blue
5
  colorTo: yellow
6
  sdk: gradio
app.py CHANGED
@@ -6,13 +6,13 @@ pipeline = pipeline(
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 = """
@@ -24,10 +24,12 @@ shoutout to [@p1atdev](https://huggingface.co/p1atdev) for his awesome work **~(
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()
 
6
  )
7
 
8
 
9
+ def predict(input_img,threshold,return_scores):
10
  predictions = pipeline(
11
  input_img,
12
+ threshold=threshold, # optional parameter defaults to 0
13
+ return_scores=return_scores, # optional parameter defaults to False
14
  )
15
+ return f"""```json\n{predictions}```"""
16
 
17
 
18
  description = """
 
24
 
25
  app = gr.Interface(
26
  predict,
27
+ inputs=[gr.Image(label="add your image here"),gr.Slider(0,1,0.5,label="threshold"),gr.Checkbox(False,label="show scores")],
28
+ outputs=gr.Markdown(label="tags",value="``\n\n\n```"),
29
  title="Image Annotator",
30
  description=description,
31
+ examples=[["./lowres XD.jpg",0.5,False],["./pixeled lain.jpg",0.8,True]],
32
+ cache_examples=True
33
  )
34
 
35
  app.launch()
lowres XD.jpg ADDED
pixeled lain.jpg ADDED