Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -114,7 +114,7 @@ i2i_pipe = StableDiffusionImg2ImgPipeline(
|
|
| 114 |
image_encoder=None
|
| 115 |
)
|
| 116 |
|
| 117 |
-
# Translation function (
|
| 118 |
@spaces.GPU
|
| 119 |
def translate_albanian_to_english(text):
|
| 120 |
if not text.strip():
|
|
@@ -327,7 +327,7 @@ def process(input_fg, prompt, image_width, image_height, num_samples, seed, step
|
|
| 327 |
output_type='latent',
|
| 328 |
guidance_scale=cfg,
|
| 329 |
cross_attention_kwargs={'concat_conds': concat_conds},
|
| 330 |
-
|
| 331 |
|
| 332 |
pixels = vae.decode(latents).sample
|
| 333 |
|
|
@@ -388,11 +388,26 @@ def create_demo():
|
|
| 388 |
prompt = gr.Textbox(label="Përshkrimi", placeholder="Shkruani përshkrimin këtu")
|
| 389 |
bg_source = gr.Radio(choices=[e.value for e in BGSource], value=BGSource.NONE.value, label="Preferenca e Ndriçimit", type='value')
|
| 390 |
relight_button = gr.Button(value="Rindriço")
|
| 391 |
-
|
| 392 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 393 |
|
| 394 |
# Bind the relight button
|
| 395 |
-
ips = [
|
|
|
|
|
|
|
|
|
|
| 396 |
relight_button.click(fn=process_relight, inputs=ips, outputs=[output_bg, result_gallery])
|
| 397 |
|
| 398 |
return block
|
|
|
|
| 114 |
image_encoder=None
|
| 115 |
)
|
| 116 |
|
| 117 |
+
# Translation function (unchanged)
|
| 118 |
@spaces.GPU
|
| 119 |
def translate_albanian_to_english(text):
|
| 120 |
if not text.strip():
|
|
|
|
| 327 |
output_type='latent',
|
| 328 |
guidance_scale=cfg,
|
| 329 |
cross_attention_kwargs={'concat_conds': concat_conds},
|
| 330 |
+
).images.to(vae.dtype) / vae.config.scaling_factor
|
| 331 |
|
| 332 |
pixels = vae.decode(latents).sample
|
| 333 |
|
|
|
|
| 388 |
prompt = gr.Textbox(label="Përshkrimi", placeholder="Shkruani përshkrimin këtu")
|
| 389 |
bg_source = gr.Radio(choices=[e.value for e in BGSource], value=BGSource.NONE.value, label="Preferenca e Ndriçimit", type='value')
|
| 390 |
relight_button = gr.Button(value="Rindriço")
|
| 391 |
+
# Hidden components for other parameters
|
| 392 |
+
image_width = gr.Slider(label="Gjerësia e Imazhit", minimum=256, maximum=1024, value=640, step=64, visible=False)
|
| 393 |
+
image_height = gr.Slider(label="Lartësia e Imazhit", minimum=256, maximum=1024, value=640, step=64, visible=False)
|
| 394 |
+
num_samples = gr.Slider(label="Numri i Imazheve", minimum=1, maximum=12, value=1, step=1, visible=False)
|
| 395 |
+
seed = gr.Number(label="Fara", value=12345, precision=0, visible=False)
|
| 396 |
+
steps = gr.Slider(label="Hapat", minimum=1, maximum=100, value=50, step=1, visible=False)
|
| 397 |
+
a_prompt = gr.Textbox(label="Përshkrim i Shtuar", value='best quality', visible=False)
|
| 398 |
+
n_prompt = gr.Textbox(label="Përshkrim Negativ", value='lowres, bad anatomy, bad hands, cropped, worst quality', visible=False)
|
| 399 |
+
cfg = gr.Slider(label="Shkalla CFG", minimum=1.0, maximum=32.0, value=2, step=0.01, visible=False)
|
| 400 |
+
highres_scale = gr.Slider(label="Shkalla e Rezolutës së Lartë", minimum=1.0, maximum=3.0, value=2, step=0.01, visible=False)
|
| 401 |
+
highres_denoise = gr.Slider(label="Denoise i Rezolutës së Lartë", minimum=0.1, maximum=1.0, value=0.5, step=0.01, visible=False)
|
| 402 |
+
lowres_denoise = gr.Slider(label="Denoise i Rezolutës së Ulët", minimum=0.1, maximum=1.0, value=0.9, step=0.01, visible=False)
|
| 403 |
+
result_gallery = gr.Gallery(label='Rezultatet', visible=False)
|
| 404 |
+
output_bg = gr.Image(type="numpy", label="Parapërpunimi i Planit të Parë", visible=False)
|
| 405 |
|
| 406 |
# Bind the relight button
|
| 407 |
+
ips = [
|
| 408 |
+
input_fg, prompt, image_width, image_height, num_samples, seed, steps,
|
| 409 |
+
a_prompt, n_prompt, cfg, highres_scale, highres_denoise, lowres_denoise, bg_source
|
| 410 |
+
]
|
| 411 |
relight_button.click(fn=process_relight, inputs=ips, outputs=[output_bg, result_gallery])
|
| 412 |
|
| 413 |
return block
|