Spaces:
Running
on
Zero
Running
on
Zero
roman-bachmann
commited on
Commit
•
3222587
1
Parent(s):
b562e4e
Update app.py
Browse files
app.py
CHANGED
@@ -73,8 +73,7 @@ def infer(img_path, seed=0, randomize_seed=False, target_modalities=None, top_p=
|
|
73 |
seed = None
|
74 |
img = img_from_path(img_path).to(device)
|
75 |
preds = sampler({'rgb@224': img}, seed=seed, target_modalities=target_modalities, top_p=top_p, top_k=top_k)
|
76 |
-
sampler.
|
77 |
-
return './output.png'
|
78 |
|
79 |
|
80 |
examples = [
|
@@ -140,7 +139,10 @@ with gr.Blocks(css=css, theme=gr.themes.Base()) as demo:
|
|
140 |
top_p = gr.Slider(label="Top-p", minimum=0.0, maximum=1.0, step=0.01, value=0.8)
|
141 |
top_k = gr.Slider(label="Top-k", minimum=0.0, maximum=1.0, step=0.01, value=0.0)
|
142 |
|
143 |
-
result = gr.
|
|
|
|
|
|
|
144 |
|
145 |
gr.Examples(
|
146 |
examples = examples,
|
|
|
73 |
seed = None
|
74 |
img = img_from_path(img_path).to(device)
|
75 |
preds = sampler({'rgb@224': img}, seed=seed, target_modalities=target_modalities, top_p=top_p, top_k=top_k)
|
76 |
+
return sampler.modalities_to_pil(preds, use_fixed_plotting_order=True, resize=512)
|
|
|
77 |
|
78 |
|
79 |
examples = [
|
|
|
139 |
top_p = gr.Slider(label="Top-p", minimum=0.0, maximum=1.0, step=0.01, value=0.8)
|
140 |
top_k = gr.Slider(label="Top-k", minimum=0.0, maximum=1.0, step=0.01, value=0.0)
|
141 |
|
142 |
+
result = gr.Gallery(
|
143 |
+
label="Predictions", show_label=True, elem_id="gallery", type='pil',
|
144 |
+
columns=[4], rows=None, object_fit="contain", height="auto"
|
145 |
+
)
|
146 |
|
147 |
gr.Examples(
|
148 |
examples = examples,
|