sayedM commited on
Commit
6027eca
·
1 Parent(s): ff9dd4b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -38,10 +38,13 @@ def get_results(image, prompt,segment):
38
 
39
  # Prepare the payload (Adjust this part according to the API requirements)
40
  #payload = json.dumps({"base64str": base64str, "classes": prompt})
 
 
 
41
  payload = {
42
  "base64str": base64str,
43
  "classes": prompt,
44
- "segment": "1" if segment else "0" # 1 if checkbox is selected, 0 if not
45
  }
46
  # Send the request to the API
47
  response = requests.put(api_key, data=payload)
@@ -142,7 +145,9 @@ with gr.Blocks() as demo:
142
  with gr.Row():
143
  text_input = gr.inputs.Textbox(label="Prompt")
144
  with gr.Row():
145
- segment_checkbox = gr.inputs.Checkbox(label="Segment", default=False)
 
 
146
  with gr.Row():
147
  button = gr.Button("Run")
148
 
 
38
 
39
  # Prepare the payload (Adjust this part according to the API requirements)
40
  #payload = json.dumps({"base64str": base64str, "classes": prompt})
41
+ task_="0"
42
+ if segment == "Segmentation":
43
+ task_="1"
44
  payload = {
45
  "base64str": base64str,
46
  "classes": prompt,
47
+ "segment": task_ # 1 if checkbox is selected, 0 if not
48
  }
49
  # Send the request to the API
50
  response = requests.put(api_key, data=payload)
 
145
  with gr.Row():
146
  text_input = gr.inputs.Textbox(label="Prompt")
147
  with gr.Row():
148
+ segment_checkbox = gr.Radio(["Segmentation", "Detection"], value="file",
149
+ label="Condition on a task (optional) Segmentation or Detection")
150
+ #segment_checkbox = gr.inputs.Checkbox(label="Segment", default=False)
151
  with gr.Row():
152
  button = gr.Button("Run")
153