Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,9 @@ import gradio as gr
|
|
2 |
import torch
|
3 |
from PIL import Image
|
4 |
from src.pipeline_pe_clone import FluxPipeline
|
5 |
-
import
|
|
|
|
|
6 |
|
7 |
@spaces.GPU()
|
8 |
def generate_image(model_path, image, height, width, prompt, guidance_scale, num_steps, lora_name):
|
@@ -37,17 +39,17 @@ def generate_image(model_path, image, height, width, prompt, guidance_scale, num
|
|
37 |
|
38 |
return result
|
39 |
|
40 |
-
# Create Gradio interface
|
41 |
iface = gr.Interface(
|
42 |
fn=generate_image,
|
43 |
inputs=[
|
44 |
gr.Textbox(label="Model Path", value="black-forest-labs/FLUX.1-dev"),
|
45 |
-
gr.Image(label="Input Image", type="pil"),
|
46 |
-
gr.
|
47 |
-
gr.
|
48 |
gr.Textbox(label="Prompt", value="add a halo and wings for the cat by sksmagiceffects"),
|
49 |
-
gr.
|
50 |
-
gr.
|
51 |
gr.Dropdown(
|
52 |
label="LoRA Name",
|
53 |
choices=["pretrained", "sksmagiceffects", "sksmonstercalledlulu",
|
|
|
2 |
import torch
|
3 |
from PIL import Image
|
4 |
from src.pipeline_pe_clone import FluxPipeline
|
5 |
+
import spaces
|
6 |
+
# Load default image from assets as an example
|
7 |
+
default_image = Image.open("assets/1.png")
|
8 |
|
9 |
@spaces.GPU()
|
10 |
def generate_image(model_path, image, height, width, prompt, guidance_scale, num_steps, lora_name):
|
|
|
39 |
|
40 |
return result
|
41 |
|
42 |
+
# Create Gradio interface with sliders for numeric inputs
|
43 |
iface = gr.Interface(
|
44 |
fn=generate_image,
|
45 |
inputs=[
|
46 |
gr.Textbox(label="Model Path", value="black-forest-labs/FLUX.1-dev"),
|
47 |
+
gr.Image(label="Input Image", type="pil", value=default_image),
|
48 |
+
gr.Slider(label="Height", value=768, minimum=256, maximum=1024, step=64),
|
49 |
+
gr.Slider(label="Width", value=512, minimum=256, maximum=1024, step=64),
|
50 |
gr.Textbox(label="Prompt", value="add a halo and wings for the cat by sksmagiceffects"),
|
51 |
+
gr.Slider(label="Guidance Scale", value=3.5, minimum=1.0, maximum=10.0, step=0.1),
|
52 |
+
gr.Slider(label="Number of Steps", value=20, minimum=1, maximum=100, step=1),
|
53 |
gr.Dropdown(
|
54 |
label="LoRA Name",
|
55 |
choices=["pretrained", "sksmagiceffects", "sksmonstercalledlulu",
|