Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -383,6 +383,22 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 383 |
trial_id = gr.Textbox(visible=False)
|
| 384 |
output_buf = gr.State()
|
| 385 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 386 |
def load_example(evt: gr.SelectData):
|
| 387 |
selected_image = Image.open(example_images[evt.index])
|
| 388 |
trial_id_val, processed_image = preprocess_image(selected_image)
|
|
@@ -465,22 +481,6 @@ if __name__ == "__main__":
|
|
| 465 |
except Exception as e:
|
| 466 |
print(f"Warning: Initial preprocessing test failed: {e}")
|
| 467 |
|
| 468 |
-
# Examples ๊ฐค๋ฌ๋ฆฌ ์ค์
|
| 469 |
-
if example_images:
|
| 470 |
-
gr.Markdown("""### Example Images""")
|
| 471 |
-
with gr.Row():
|
| 472 |
-
gallery = gr.Gallery(
|
| 473 |
-
value=example_images,
|
| 474 |
-
label="Click an image to use it",
|
| 475 |
-
show_label=True,
|
| 476 |
-
elem_id="gallery",
|
| 477 |
-
columns=12, # ํ ์ค์ 12๊ฐ
|
| 478 |
-
rows=2, # 2์ค
|
| 479 |
-
height=300, # ๋์ด ์กฐ์
|
| 480 |
-
allow_preview=True,
|
| 481 |
-
object_fit="contain" # ์ด๋ฏธ์ง ๋น์จ ์ ์ง
|
| 482 |
-
)
|
| 483 |
-
|
| 484 |
# Gradio ์ธํฐํ์ด์ค ์คํ
|
| 485 |
demo.queue() # ํ ๊ธฐ๋ฅ ํ์ฑํ
|
| 486 |
demo.launch(
|
|
|
|
| 383 |
trial_id = gr.Textbox(visible=False)
|
| 384 |
output_buf = gr.State()
|
| 385 |
|
| 386 |
+
# Examples ๊ฐค๋ฌ๋ฆฌ๋ฅผ ๋งจ ์๋๋ก ์ด๋
|
| 387 |
+
if example_images:
|
| 388 |
+
gr.Markdown("""### Example Images""")
|
| 389 |
+
with gr.Row():
|
| 390 |
+
gallery = gr.Gallery(
|
| 391 |
+
value=example_images,
|
| 392 |
+
label="Click an image to use it",
|
| 393 |
+
show_label=True,
|
| 394 |
+
elem_id="gallery",
|
| 395 |
+
columns=12, # ํ ์ค์ 12๊ฐ
|
| 396 |
+
rows=2, # 2์ค
|
| 397 |
+
height=300, # ๋์ด ์กฐ์
|
| 398 |
+
allow_preview=True,
|
| 399 |
+
object_fit="contain" # ์ด๋ฏธ์ง ๋น์จ ์ ์ง
|
| 400 |
+
)
|
| 401 |
+
|
| 402 |
def load_example(evt: gr.SelectData):
|
| 403 |
selected_image = Image.open(example_images[evt.index])
|
| 404 |
trial_id_val, processed_image = preprocess_image(selected_image)
|
|
|
|
| 481 |
except Exception as e:
|
| 482 |
print(f"Warning: Initial preprocessing test failed: {e}")
|
| 483 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 484 |
# Gradio ์ธํฐํ์ด์ค ์คํ
|
| 485 |
demo.queue() # ํ ๊ธฐ๋ฅ ํ์ฑํ
|
| 486 |
demo.launch(
|