xmrt commited on
Commit
4109d5a
·
1 Parent(s): 3eb1cdc

new example test

Browse files
Files changed (1) hide show
  1. app.py +11 -8
app.py CHANGED
@@ -54,15 +54,14 @@ def query_image(img, text_queries, score_threshold):
54
  return img
55
 
56
 
57
- description = """
58
- \n\nYou can use OWL-ViT to query images with text descriptions of any object.
59
- To use it, simply upload an image and enter comma separated text descriptions of objects you want to query the image for. You
60
- can also use the score threshold slider to set a threshold to filter out low probability predictions.
61
- """
62
-
63
  with gr.Blocks() as demo:
64
  with gr.Column():
65
  with gr.Tab("Upload image"):
 
 
 
 
 
66
  with gr.Row():
67
  with gr.Column():
68
  inputs_file=[gr.Image(source="upload"), gr.Textbox(), gr.Slider(0, 1, value=0.1)]
@@ -82,8 +81,12 @@ with gr.Blocks() as demo:
82
  submit_btn_web.click(fn=query_image, inputs= inputs_web, outputs = web_output)
83
 
84
  gr.Markdown("## Image Examples")
85
- examples= ["IMGP0178.jpg"]
86
 
87
- gr.Examples([[os.path.join(os.getcwd(), "IMGP0178.jpg")], [os.path.join(os.getcwd(), "coffee.jpg")]], [inputs_file], [im_output], query_image)
 
 
 
 
88
 
89
  demo.launch()
 
54
  return img
55
 
56
 
 
 
 
 
 
 
57
  with gr.Blocks() as demo:
58
  with gr.Column():
59
  with gr.Tab("Upload image"):
60
+ gr.Markdown("""
61
+ ### [OWL-ViT](https://huggingface.co/docs/transformers/model_doc/owlvit) is a vision transformer architecture that can be used for image inputs with text queries. This is achieved by adding a text embedding layer to the model, which allows it to process both image and text inputs.
62
+ ### \n You can use to query images with text descriptions of any object. To use it, simply upload an image or capture one with the webcam and enter comma separated text descriptions of objects you want to query the image for.
63
+ ### \n You can also use the score threshold slider to set a threshold to filter out low probability predictions.
64
+ """)
65
  with gr.Row():
66
  with gr.Column():
67
  inputs_file=[gr.Image(source="upload"), gr.Textbox(), gr.Slider(0, 1, value=0.1)]
 
81
  submit_btn_web.click(fn=query_image, inputs= inputs_web, outputs = web_output)
82
 
83
  gr.Markdown("## Image Examples")
84
+ #examples= ["IMGP0178.jpg"]
85
 
86
+ gr.Examples(examples=[os.path.join(os.getcwd(), "IMGP0178.jpg"), os.path.join(os.getcwd(), "coffee.jpg")],
87
+ inputs=[inputs_file],
88
+ outputs=[im_output],
89
+ fn=query_image,
90
+ postprocess=False)
91
 
92
  demo.launch()