Spaces:
Sleeping
Sleeping
Hide info testboxes
Browse files
app.py
CHANGED
|
@@ -13,6 +13,8 @@ from src.smc.inference import (
|
|
| 13 |
FTInferenceConfig,
|
| 14 |
)
|
| 15 |
|
|
|
|
|
|
|
| 16 |
def get_device():
|
| 17 |
if not hasattr(get_device, "last_allocated"):
|
| 18 |
get_device.last_allocated = -1 # type: ignore
|
|
@@ -162,10 +164,10 @@ with gr.Blocks() as demo:
|
|
| 162 |
|
| 163 |
with gr.Column(scale=2):
|
| 164 |
pretrained_gallery = gr.Gallery(
|
| 165 |
-
label="Pretrained model outputs", show_label=True, elem_id="pretrained_gallery", height=
|
| 166 |
object_fit="contain",
|
| 167 |
)
|
| 168 |
-
pretrained_info = gr.Textbox(label="Pretrained info", interactive=False)
|
| 169 |
|
| 170 |
# --- SMC-grad method row ---
|
| 171 |
with gr.Row():
|
|
@@ -205,10 +207,10 @@ with gr.Blocks() as demo:
|
|
| 205 |
|
| 206 |
with gr.Column(scale=2):
|
| 207 |
smc_grad_gallery = gr.Gallery(
|
| 208 |
-
label="SMC-grad outputs", show_label=True, elem_id="smc_grad_gallery", height=
|
| 209 |
object_fit="contain",
|
| 210 |
)
|
| 211 |
-
smc_grad_info = gr.Textbox(label="SMC-grad info", interactive=False)
|
| 212 |
|
| 213 |
# --- FT method row ---
|
| 214 |
with gr.Row():
|
|
@@ -222,10 +224,10 @@ with gr.Blocks() as demo:
|
|
| 222 |
|
| 223 |
with gr.Column(scale=2):
|
| 224 |
ft_gallery = gr.Gallery(
|
| 225 |
-
label="Finetuned model outputs", show_label=True, elem_id="ft_gallery", height=
|
| 226 |
object_fit="contain",
|
| 227 |
)
|
| 228 |
-
ft_info = gr.Textbox(label="Finetuned info", interactive=False)
|
| 229 |
|
| 230 |
# --- Wiring ---
|
| 231 |
# 1) Quick 'running' update attached to the button so the UI shows immediate feedback.
|
|
|
|
| 13 |
FTInferenceConfig,
|
| 14 |
)
|
| 15 |
|
| 16 |
+
GALLERY_HEIGHT = "224px"
|
| 17 |
+
|
| 18 |
def get_device():
|
| 19 |
if not hasattr(get_device, "last_allocated"):
|
| 20 |
get_device.last_allocated = -1 # type: ignore
|
|
|
|
| 164 |
|
| 165 |
with gr.Column(scale=2):
|
| 166 |
pretrained_gallery = gr.Gallery(
|
| 167 |
+
label="Pretrained model outputs", show_label=True, elem_id="pretrained_gallery", height=GALLERY_HEIGHT, columns=4,
|
| 168 |
object_fit="contain",
|
| 169 |
)
|
| 170 |
+
pretrained_info = gr.Textbox(label="Pretrained info", interactive=False, visible=False)
|
| 171 |
|
| 172 |
# --- SMC-grad method row ---
|
| 173 |
with gr.Row():
|
|
|
|
| 207 |
|
| 208 |
with gr.Column(scale=2):
|
| 209 |
smc_grad_gallery = gr.Gallery(
|
| 210 |
+
label="SMC-grad outputs", show_label=True, elem_id="smc_grad_gallery", height=GALLERY_HEIGHT, columns=4,
|
| 211 |
object_fit="contain",
|
| 212 |
)
|
| 213 |
+
smc_grad_info = gr.Textbox(label="SMC-grad info", interactive=False, visible=False)
|
| 214 |
|
| 215 |
# --- FT method row ---
|
| 216 |
with gr.Row():
|
|
|
|
| 224 |
|
| 225 |
with gr.Column(scale=2):
|
| 226 |
ft_gallery = gr.Gallery(
|
| 227 |
+
label="Finetuned model outputs", show_label=True, elem_id="ft_gallery", height=GALLERY_HEIGHT, columns=4,
|
| 228 |
object_fit="contain",
|
| 229 |
)
|
| 230 |
+
ft_info = gr.Textbox(label="Finetuned info", interactive=False, visible=False)
|
| 231 |
|
| 232 |
# --- Wiring ---
|
| 233 |
# 1) Quick 'running' update attached to the button so the UI shows immediate feedback.
|