Spaces:
Sleeping
Sleeping
change layout and fix issue with natural image
Browse files
app.py
CHANGED
@@ -34,7 +34,7 @@ def generate_imgs_from_user(image,
|
|
34 |
physics: PhysicsWithGenerator, use_gen: bool,
|
35 |
metrics: List[Metric]):
|
36 |
# PIL image -> torch.Tensor
|
37 |
-
x = transforms.ToTensor()(image).unsqueeze(0)
|
38 |
|
39 |
return generate_imgs(x, model, baseline, physics, use_gen, metrics)
|
40 |
|
@@ -147,7 +147,7 @@ with gr.Blocks(title=title, css=custom_css) as interface:
|
|
147 |
# Loading things
|
148 |
model_a_placeholder = gr.State(lambda: get_eval_model_on_DEVICE_STR("unext_emb_physics_config_C", "")) # lambda expression to instanciate a callable in a gr.State
|
149 |
model_b_placeholder = gr.State(lambda: get_baseline_model_on_DEVICE_STR("DPIR")) # lambda expression to instanciate a callable in a gr.State
|
150 |
-
dataset_placeholder = gr.State(
|
151 |
physics_placeholder = gr.State(lambda: get_physics_on_DEVICE_STR("MotionBlur_easy")) # lambda expression to instanciate a callable in a gr.State
|
152 |
metrics_placeholder = gr.State(get_list_metrics_on_DEVICE_STR(["PSNR"]))
|
153 |
|
@@ -196,12 +196,12 @@ with gr.Blocks(title=title, css=custom_css) as interface:
|
|
196 |
|
197 |
# Components: Load Metric + Load image Buttons
|
198 |
with gr.Row():
|
199 |
-
with gr.Column(scale=
|
200 |
choose_metrics = gr.CheckboxGroup(choices=Metric.all_metrics,
|
201 |
value=metric_names,
|
202 |
label="Choose metrics you are interested")
|
203 |
use_generator_button = gr.Checkbox(label="Generate valid physics parameters", scale=1)
|
204 |
-
run_button = gr.Button("Run current image")
|
205 |
with gr.Column(scale=1):
|
206 |
load_button = gr.Button("Load images from dataset...")
|
207 |
load_random_button = gr.Button("Load randomly from dataset...")
|
|
|
34 |
physics: PhysicsWithGenerator, use_gen: bool,
|
35 |
metrics: List[Metric]):
|
36 |
# PIL image -> torch.Tensor
|
37 |
+
x = transforms.ToTensor()(image).unsqueeze(0).to('cuda')
|
38 |
|
39 |
return generate_imgs(x, model, baseline, physics, use_gen, metrics)
|
40 |
|
|
|
147 |
# Loading things
|
148 |
model_a_placeholder = gr.State(lambda: get_eval_model_on_DEVICE_STR("unext_emb_physics_config_C", "")) # lambda expression to instanciate a callable in a gr.State
|
149 |
model_b_placeholder = gr.State(lambda: get_baseline_model_on_DEVICE_STR("DPIR")) # lambda expression to instanciate a callable in a gr.State
|
150 |
+
dataset_placeholder = gr.State(lambda: get_dataset("Natural"))
|
151 |
physics_placeholder = gr.State(lambda: get_physics_on_DEVICE_STR("MotionBlur_easy")) # lambda expression to instanciate a callable in a gr.State
|
152 |
metrics_placeholder = gr.State(get_list_metrics_on_DEVICE_STR(["PSNR"]))
|
153 |
|
|
|
196 |
|
197 |
# Components: Load Metric + Load image Buttons
|
198 |
with gr.Row():
|
199 |
+
with gr.Column(scale=3):
|
200 |
choose_metrics = gr.CheckboxGroup(choices=Metric.all_metrics,
|
201 |
value=metric_names,
|
202 |
label="Choose metrics you are interested")
|
203 |
use_generator_button = gr.Checkbox(label="Generate valid physics parameters", scale=1)
|
204 |
+
run_button = gr.Button("Run current image", scale=1)
|
205 |
with gr.Column(scale=1):
|
206 |
load_button = gr.Button("Load images from dataset...")
|
207 |
load_random_button = gr.Button("Load randomly from dataset...")
|