donb-hf commited on
Commit
10b8cf9
·
1 Parent(s): 43ba1c2

update gradio output

Browse files
Files changed (1) hide show
  1. app.py +27 -26
app.py CHANGED
@@ -55,39 +55,40 @@ IMAGE_PROMPT="Are these cells healthy or cancerous?"
55
 
56
  with gr.Blocks(css="style.css") as demo:
57
  gr.Markdown(INTRO_TEXT)
58
- with gr.Tab("Agentic Detection"):
59
  with gr.Row():
60
  with gr.Column():
61
- image = gr.Image(type="numpy")
 
 
62
  with gr.Column():
63
- text_input = gr.Text(label="Input Text")
64
- text_output = gr.Text(label="Text Output")
65
- chat_btn = gr.Button()
66
 
67
- chat_inputs = [
68
- image
69
- ]
70
- chat_outputs = [
71
- text_output
72
- ]
73
- chat_btn.click(
74
- fn=detect_brain_tumor,
75
- inputs=chat_inputs,
76
- outputs=chat_outputs,
77
- )
78
-
79
- examples = [["./examples/194_jpg.rf.3e3dd592d034bb5ee27a978553819f42.jpg"],
80
- ["./examples/239_jpg.rf.3dcc0799277fb78a2ab21db7761ccaeb.jpg"],
81
- ["./examples/1385_jpg.rf.3c67cb92e2922dba0e6dba86f69df40b.jpg"],
82
- ["./examples/1491_jpg.rf.3c658e83538de0fa5a3f4e13d7d85f12.jpg"],
83
- ["./examples/1550_jpg.rf.3d067be9580ec32dbee5a89c675d8459.jpg"],
84
- ["./examples/2256_jpg.rf.3afd7903eaf3f3c5aa8da4bbb928bc19.jpg"],
85
- ["./examples/2871_jpg.rf.3b6eadfbb369abc2b3bcb52b406b74f2.jpg"],
86
- ["./examples/2921_jpg.rf.3b952f91f27a6248091e7601c22323ad.jpg"],
87
  ]
88
  gr.Examples(
89
  examples=examples,
90
- inputs=chat_inputs,
 
 
 
 
 
 
 
 
 
 
 
 
91
  )
92
 
93
  if __name__ == "__main__":
 
55
 
56
  with gr.Blocks(css="style.css") as demo:
57
  gr.Markdown(INTRO_TEXT)
58
+ with gr.Tab("Segment/Detect"):
59
  with gr.Row():
60
  with gr.Column():
61
+ image = gr.Image(type="pil")
62
+ seg_input = gr.Text(label="Entities to Segment/Detect")
63
+
64
  with gr.Column():
65
+ annotated_image = gr.AnnotatedImage(label="Output")
 
 
66
 
67
+ seg_btn = gr.Button("Submit")
68
+ examples = [["./examples/194_jpg.rf.3e3dd592d034bb5ee27a978553819f42.jpg", "detect brain tumor"],
69
+ ["./examples/239_jpg.rf.3dcc0799277fb78a2ab21db7761ccaeb.jpg", "detect brain tumor"],
70
+ ["./examples/1385_jpg.rf.3c67cb92e2922dba0e6dba86f69df40b.jpg", "detect brain tumor"],
71
+ ["./examples/1491_jpg.rf.3c658e83538de0fa5a3f4e13d7d85f12.jpg", "detect brain tumor"],
72
+ ["./examples/1550_jpg.rf.3d067be9580ec32dbee5a89c675d8459.jpg", "detect brain tumor"],
73
+ ["./examples/2256_jpg.rf.3afd7903eaf3f3c5aa8da4bbb928bc19.jpg", "detect brain tumor"],
74
+ ["./examples/2871_jpg.rf.3b6eadfbb369abc2b3bcb52b406b74f2.jpg", "detect brain tumor"],
75
+ ["./examples/2921_jpg.rf.3b952f91f27a6248091e7601c22323ad.jpg", "detect brain tumor"],
 
 
 
 
 
 
 
 
 
 
 
76
  ]
77
  gr.Examples(
78
  examples=examples,
79
+ inputs=[image, seg_input],
80
+ )
81
+ seg_inputs = [
82
+ image,
83
+ seg_input
84
+ ]
85
+ seg_outputs = [
86
+ annotated_image
87
+ ]
88
+ seg_btn.click(
89
+ fn=detect_brain_tumor,
90
+ inputs=seg_inputs,
91
+ outputs=seg_outputs,
92
  )
93
 
94
  if __name__ == "__main__":