fffiloni commited on
Commit
dc9bdbf
·
verified ·
1 Parent(s): 8c2e68c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -34,13 +34,14 @@ def image_vision(image_input_path, prompt):
34
  return_dict = model.predict_forward(**input_dict)
35
  print(return_dict)
36
  answer = return_dict["prediction"] # the text format answer
 
37
 
38
- return answer
39
 
40
  def main_infer(image_input_path, prompt):
41
 
42
- response = image_vision(image_input_path, prompt)
43
- return response
44
 
45
  # Gradio UI
46
 
@@ -55,11 +56,12 @@ with gr.Blocks() as demo:
55
  submit_btn = gr.Button("Submit", scale=1)
56
  with gr.Column():
57
  output_res = gr.Textbox(label="Response")
 
58
 
59
  submit_btn.click(
60
  fn = main_infer,
61
  inputs = [image_input, instruction],
62
- outputs = [output_res]
63
  )
64
 
65
  demo.queue().launch(show_api=False, show_error=True)
 
34
  return_dict = model.predict_forward(**input_dict)
35
  print(return_dict)
36
  answer = return_dict["prediction"] # the text format answer
37
+ seg_image = return_dict["prediction_masks"]
38
 
39
+ return answer, seg_image
40
 
41
  def main_infer(image_input_path, prompt):
42
 
43
+ answer, seg_image = image_vision(image_input_path, prompt)
44
+ return answer, seg_image
45
 
46
  # Gradio UI
47
 
 
56
  submit_btn = gr.Button("Submit", scale=1)
57
  with gr.Column():
58
  output_res = gr.Textbox(label="Response")
59
+ output_image = gr.Image(label="Segmentation")
60
 
61
  submit_btn.click(
62
  fn = main_infer,
63
  inputs = [image_input, instruction],
64
+ outputs = [output_res, output_image]
65
  )
66
 
67
  demo.queue().launch(show_api=False, show_error=True)