ginipick commited on
Commit
ead5832
ยท
verified ยท
1 Parent(s): fa5316d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -19
app.py CHANGED
@@ -212,6 +212,7 @@ footer {display: none}
212
  }
213
  """
214
 
 
215
  # Gradio UI
216
  with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
217
  gr.HTML("""
@@ -222,6 +223,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
222
  """)
223
 
224
  with gr.Tabs() as tabs:
 
225
  with gr.Tab("โœจ Extract by Text", id="tab_prompt"):
226
  with gr.Row(equal_height=True):
227
  with gr.Column(scale=1, min_width=400):
@@ -255,27 +257,21 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
255
  "๐Ÿ’พ Download Result",
256
  interactive=False
257
  )
258
- # Bounding Box ํƒญ์˜ Examples ๋ถ€๋ถ„ ์ˆ˜์ •
259
  with gr.Accordion("๐Ÿ“š Examples", open=False):
260
- examples_bb = [
261
- {
262
- "image": "examples/text.jpg",
263
- "boxes": [{"xmin": 51, "ymin": 511, "xmax": 639, "ymax": 1255}]
264
- },
265
- {
266
- "image": "examples/black-lamp.jpg",
267
- "boxes": [{"xmin": 88, "ymin": 148, "xmax": 700, "ymax": 1414}]
268
- }
269
  ]
270
- ex_bb = gr.Examples(
271
- examples=examples_bb,
272
- inputs=[annotator],
273
- outputs=[oimg_bb, dlbt_bb],
274
- fn=process_bbox,
275
  cache_examples=True
276
  )
277
 
278
-
279
  with gr.Tab("๐Ÿ“ Extract by Box", id="tab_bb"):
280
  with gr.Row(equal_height=True):
281
  with gr.Column(scale=1, min_width=400):
@@ -305,6 +301,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
305
  interactive=False
306
  )
307
 
 
308
  with gr.Accordion("๐Ÿ“š Examples", open=False):
309
  examples_bb = [
310
  {
@@ -318,13 +315,12 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
318
  ]
319
  ex_bb = gr.Examples(
320
  examples=examples_bb,
321
- inputs=[annotator],
322
  outputs=[oimg_bb, dlbt_bb],
323
  fn=process_bbox,
324
  cache_examples=True
325
  )
326
 
327
-
328
  # Event handlers
329
  btn.add(oimg)
330
  for inp in [iimg, prompt]:
@@ -360,4 +356,5 @@ demo.launch(
360
  server_name="0.0.0.0",
361
  server_port=7860,
362
  show_error=True
363
- )
 
 
212
  }
213
  """
214
 
215
+ # Gradio UI
216
  # Gradio UI
217
  with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
218
  gr.HTML("""
 
223
  """)
224
 
225
  with gr.Tabs() as tabs:
226
+ # Text ํƒญ
227
  with gr.Tab("โœจ Extract by Text", id="tab_prompt"):
228
  with gr.Row(equal_height=True):
229
  with gr.Column(scale=1, min_width=400):
 
257
  "๐Ÿ’พ Download Result",
258
  interactive=False
259
  )
260
+
261
  with gr.Accordion("๐Ÿ“š Examples", open=False):
262
+ examples = [
263
+ ["examples/text.jpg", "text", "white background"],
264
+ ["examples/black-lamp.jpg", "black lamp", "minimalist interior"]
 
 
 
 
 
 
265
  ]
266
+ ex = gr.Examples(
267
+ examples=examples,
268
+ inputs=[iimg, prompt, bg_prompt],
269
+ outputs=[oimg, dlbt],
270
+ fn=process_prompt,
271
  cache_examples=True
272
  )
273
 
274
+ # Bounding Box ํƒญ
275
  with gr.Tab("๐Ÿ“ Extract by Box", id="tab_bb"):
276
  with gr.Row(equal_height=True):
277
  with gr.Column(scale=1, min_width=400):
 
301
  interactive=False
302
  )
303
 
304
+ # Bounding Box Examples
305
  with gr.Accordion("๐Ÿ“š Examples", open=False):
306
  examples_bb = [
307
  {
 
315
  ]
316
  ex_bb = gr.Examples(
317
  examples=examples_bb,
318
+ inputs=[annotator], # annotator๊ฐ€ ์ด๋ฏธ ์ •์˜๋œ ํ›„์— ์‚ฌ์šฉ
319
  outputs=[oimg_bb, dlbt_bb],
320
  fn=process_bbox,
321
  cache_examples=True
322
  )
323
 
 
324
  # Event handlers
325
  btn.add(oimg)
326
  for inp in [iimg, prompt]:
 
356
  server_name="0.0.0.0",
357
  server_port=7860,
358
  show_error=True
359
+ )
360
+