kushagra124 commited on
Commit
7c1b1e5
1 Parent(s): b2ffb64

adding text box

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -69,6 +69,10 @@ def shot(image, labels_text):
69
  print(detections)
70
  return 0
71
 
 
 
 
 
72
  with gr.Blocks(title="Zero Shot Object ddetection using Text Prompts") as demo :
73
  gr.Markdown(
74
  """
@@ -84,10 +88,11 @@ with gr.Blocks(title="Zero Shot Object ddetection using Text Prompts") as demo :
84
  with gr.Row():
85
  with gr.Column():
86
  inputt = gr.Image(type="numpy", label="Input Image for Classification")
87
- labels = gr.Textbox(placeholder="Enter Label/ labels ex. cat,car,door,window,",scale=4)
88
  button = gr.Button(value="Locate objects")
89
  with gr.Column():
90
  outputs = gr.Image(type="numpy", label="Detected Objects with Selected Category")
 
91
  button.click(shot,inputt,labels)
92
 
93
 
 
69
  print(detections)
70
  return 0
71
 
72
+ def add_text(text):
73
+ labels = text.split(',')
74
+ return labels
75
+
76
  with gr.Blocks(title="Zero Shot Object ddetection using Text Prompts") as demo :
77
  gr.Markdown(
78
  """
 
88
  with gr.Row():
89
  with gr.Column():
90
  inputt = gr.Image(type="numpy", label="Input Image for Classification")
91
+ labels = gr.Textbox(label="Enter Label/ labels",placeholder="ex. car,person",scale=4)
92
  button = gr.Button(value="Locate objects")
93
  with gr.Column():
94
  outputs = gr.Image(type="numpy", label="Detected Objects with Selected Category")
95
+ labels.submit(add_text, inputs=[labels])
96
  button.click(shot,inputt,labels)
97
 
98