xmrt commited on
Commit
989b236
1 Parent(s): 04a1736

text and link

Browse files
Files changed (1) hide show
  1. app.py +19 -21
app.py CHANGED
@@ -55,44 +55,42 @@ def query_image(img, text_queries, score_threshold):
55
 
56
  with gr.Blocks() as demo:
57
  with gr.Column():
58
- with gr.Tab("Upload image"):
59
- gr.Markdown("""
60
- \n 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.
61
- \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.
62
- """)
63
  with gr.Row():
64
  with gr.Column():
65
-
66
  gr.Markdown("""Insert an image below and add text descriptions of what you are looking for.
67
- If you wish for assistance to find the right text queries you can ask for help from [ChatBRD](https://chatbrd.novonordisk.com/#/) but remember you need to log on novos VPN before you can use it.""")
68
- inputf1 = gr.Image(source="upload")
69
- inputf2 = gr.Textbox()
70
  gr.Markdown("""
71
  \n You can also use the score threshold slider to set a threshold to filter out lower probability predictions.
72
  """)
73
- inputf3 = gr.Slider(0, 1, value=0.1)
74
 
75
- inputs_file = [inputf1, inputf2, inputf3]
76
- submit_btn = gr.Button("Submit")
77
 
78
- im_output = gr.Image()
79
 
80
- with gr.Tab("Capture image with webcam"):
 
 
81
  with gr.Row():
82
  with gr.Column():
 
83
  gr.Markdown("""Insert an image below and add text descriptions of what you are looking for.
84
- If you wish for assistance to find the right text queries you can ask for help from [ChatBRD](https://chatbrd.novonordisk.com/#/) but remember you need to log on novos VPN before you can use it.""")
85
- inputweb1 = gr.Image(source="webcam")
86
- inputweb2 = gr.Textbox()
87
  gr.Markdown("""
88
  \n You can also use the score threshold slider to set a threshold to filter out lower probability predictions.
89
  """)
90
- inputweb3 = gr.Slider(0, 1, value=0.1)
91
 
92
- inputs_web = [inputweb1, inputweb2, inputweb3]
93
- submit_btn_web = gr.Button("Submit")
94
 
95
- web_output = gr.Image()
96
 
97
  submit_btn.click(fn=query_image, inputs= inputs_file, outputs = im_output, queue=True)
98
  submit_btn_web.click(fn=query_image, inputs= inputs_web, outputs = web_output, queue=True)
 
55
 
56
  with gr.Blocks() as demo:
57
  with gr.Column():
58
+ with gr.Tab("Capture image with webcam"):
 
 
 
 
59
  with gr.Row():
60
  with gr.Column():
 
61
  gr.Markdown("""Insert an image below and add text descriptions of what you are looking for.
62
+ If you wish for assistance to find the right text queries you can ask for help from [ChatBRD](https://chatbrd.novonordisk.com/#/) but remember you need to log on Novo's VPN before you can use it.""")
63
+ inputweb1 = gr.Image(source="webcam")
64
+ inputweb2 = gr.Textbox()
65
  gr.Markdown("""
66
  \n You can also use the score threshold slider to set a threshold to filter out lower probability predictions.
67
  """)
68
+ inputweb3 = gr.Slider(0, 1, value=0.1)
69
 
70
+ inputs_web = [inputweb1, inputweb2, inputweb3]
71
+ submit_btn_web = gr.Button("Submit")
72
 
73
+ web_output = gr.Image()
74
 
75
+ with gr.Tab("Upload image"):
76
+ gr.Markdown("""Insert an image below and add text descriptions of what you are looking for.
77
+ If you wish for assistance to find the right text queries you can ask for help from [ChatBRD](https://chatbrd.novonordisk.com/#/) but remember you need to log on Novo's VPN before you can use it.""")
78
  with gr.Row():
79
  with gr.Column():
80
+
81
  gr.Markdown("""Insert an image below and add text descriptions of what you are looking for.
82
+ If you wish for assistance to find the right text queries you can ask for help from [ChatBRD](https://chatbrd.novonordisk.com/#/) but remember you need to log on Novo's VPN before you can use it.""")
83
+ inputf1 = gr.Image(source="upload")
84
+ inputf2 = gr.Textbox()
85
  gr.Markdown("""
86
  \n You can also use the score threshold slider to set a threshold to filter out lower probability predictions.
87
  """)
88
+ inputf3 = gr.Slider(0, 1, value=0.1)
89
 
90
+ inputs_file = [inputf1, inputf2, inputf3]
91
+ submit_btn = gr.Button("Submit")
92
 
93
+ im_output = gr.Image()
94
 
95
  submit_btn.click(fn=query_image, inputs= inputs_file, outputs = im_output, queue=True)
96
  submit_btn_web.click(fn=query_image, inputs= inputs_web, outputs = web_output, queue=True)