Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,15 +17,15 @@ def get_flux_image(prompt):
|
|
| 17 |
print(result)
|
| 18 |
return result[0]
|
| 19 |
|
| 20 |
-
def get_upscale(prompt, img_path):
|
| 21 |
client = Client("finegrain/finegrain-image-enhancer")
|
| 22 |
result = client.predict(
|
| 23 |
input_image=handle_file(img_path),
|
| 24 |
prompt=prompt,
|
| 25 |
negative_prompt="",
|
| 26 |
seed=42,
|
| 27 |
-
upscale_factor=
|
| 28 |
-
|
| 29 |
controlnet_decay=1,
|
| 30 |
condition_scale=6,
|
| 31 |
tile_width=112,
|
|
@@ -38,9 +38,9 @@ def get_upscale(prompt, img_path):
|
|
| 38 |
print(result)
|
| 39 |
return result[1]
|
| 40 |
|
| 41 |
-
def main(prompt):
|
| 42 |
step_one_flux = get_flux_image(prompt)
|
| 43 |
-
step_two_upscale = get_upscale(prompt, step_one_flux)
|
| 44 |
return (step_one_flux, step_two_upscale)
|
| 45 |
|
| 46 |
css = """
|
|
@@ -51,14 +51,22 @@ css = """
|
|
| 51 |
"""
|
| 52 |
with gr.Blocks(css=css) as demo:
|
| 53 |
with gr.Column(elem_id="col-container"):
|
| 54 |
-
gr.Markdown("Flux Upscaled")
|
| 55 |
prompt_in = gr.Textbox(label="Prompt")
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
output_res = ImageSlider(label="Flux / Upscaled")
|
| 58 |
|
| 59 |
submit_btn.click(
|
| 60 |
fn=main,
|
| 61 |
-
inputs=[prompt_in],
|
| 62 |
outputs=[output_res],
|
| 63 |
|
| 64 |
)
|
|
|
|
| 17 |
print(result)
|
| 18 |
return result[0]
|
| 19 |
|
| 20 |
+
def get_upscale(prompt, img_path, upscale_factor):
|
| 21 |
client = Client("finegrain/finegrain-image-enhancer")
|
| 22 |
result = client.predict(
|
| 23 |
input_image=handle_file(img_path),
|
| 24 |
prompt=prompt,
|
| 25 |
negative_prompt="",
|
| 26 |
seed=42,
|
| 27 |
+
upscale_factor=upscale_factor,
|
| 28 |
+
controlnet_scale=0.6,
|
| 29 |
controlnet_decay=1,
|
| 30 |
condition_scale=6,
|
| 31 |
tile_width=112,
|
|
|
|
| 38 |
print(result)
|
| 39 |
return result[1]
|
| 40 |
|
| 41 |
+
def main(prompt, upscale_factor):
|
| 42 |
step_one_flux = get_flux_image(prompt)
|
| 43 |
+
step_two_upscale = get_upscale(prompt, step_one_flux, upscale_factor)
|
| 44 |
return (step_one_flux, step_two_upscale)
|
| 45 |
|
| 46 |
css = """
|
|
|
|
| 51 |
"""
|
| 52 |
with gr.Blocks(css=css) as demo:
|
| 53 |
with gr.Column(elem_id="col-container"):
|
| 54 |
+
gr.Markdown("# Flux Upscaled")
|
| 55 |
prompt_in = gr.Textbox(label="Prompt")
|
| 56 |
+
with gr.Row():
|
| 57 |
+
upscale_factor = gr.Radio(
|
| 58 |
+
label = "UpScale Factor",
|
| 59 |
+
choices = [
|
| 60 |
+
2, 3, 4
|
| 61 |
+
],
|
| 62 |
+
value = 2
|
| 63 |
+
)
|
| 64 |
+
submit_btn = gr.Button("Submit")
|
| 65 |
output_res = ImageSlider(label="Flux / Upscaled")
|
| 66 |
|
| 67 |
submit_btn.click(
|
| 68 |
fn=main,
|
| 69 |
+
inputs=[prompt_in, upscale_factor],
|
| 70 |
outputs=[output_res],
|
| 71 |
|
| 72 |
)
|