Update apps/gradio_app.py
Browse files- apps/gradio_app.py +12 -12
apps/gradio_app.py
CHANGED
@@ -7,7 +7,7 @@ from gradio_app.project_info import (
|
|
7 |
CONTENT_OUT_1, CONTENT_OUT_2
|
8 |
)
|
9 |
from gradio_app.inference import run_inference
|
10 |
-
|
11 |
|
12 |
def run_setup_script():
|
13 |
setup_script = os.path.join(os.path.dirname(__file__), "gradio_app", "setup_scripts.py")
|
@@ -53,9 +53,9 @@ def create_gui():
|
|
53 |
"**Values greater than 4 are not recommended**. "
|
54 |
"Please ensure `Outer Scale` is greater than or equal to `Inner Scale` (default: 4)."
|
55 |
)
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
submit_button = gr.Button("Run Inference")
|
60 |
|
61 |
with gr.Column(scale=3):
|
@@ -72,14 +72,14 @@ def create_gui():
|
|
72 |
js=outer_scale_warning
|
73 |
)
|
74 |
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
|
84 |
submit_button.click(
|
85 |
fn=run_inference,
|
|
|
7 |
CONTENT_OUT_1, CONTENT_OUT_2
|
8 |
)
|
9 |
from gradio_app.inference import run_inference
|
10 |
+
from gradio_app.examples import load_examples, select_example
|
11 |
|
12 |
def run_setup_script():
|
13 |
setup_script = os.path.join(os.path.dirname(__file__), "gradio_app", "setup_scripts.py")
|
|
|
53 |
"**Values greater than 4 are not recommended**. "
|
54 |
"Please ensure `Outer Scale` is greater than or equal to `Inner Scale` (default: 4)."
|
55 |
)
|
56 |
+
examples_data = load_examples()
|
57 |
+
if not examples_data:
|
58 |
+
gr.Warning("No examples found. Check the 'apps/assets/examples' directory.")
|
59 |
submit_button = gr.Button("Run Inference")
|
60 |
|
61 |
with gr.Column(scale=3):
|
|
|
72 |
js=outer_scale_warning
|
73 |
)
|
74 |
|
75 |
+
gr.Examples(
|
76 |
+
examples=[[input_img, output_img, outer_scale] for input_img, output_img, outer_scale in examples_data],
|
77 |
+
inputs=[input_image, outer_scale],
|
78 |
+
label="Example Inputs",
|
79 |
+
examples_per_page=4,
|
80 |
+
fn=select_example,
|
81 |
+
outputs=[input_image, outer_scale, output_image, output_text]
|
82 |
+
)
|
83 |
|
84 |
submit_button.click(
|
85 |
fn=run_inference,
|