Spaces:
Paused
Paused
uuu
Browse files
app.py
CHANGED
|
@@ -21,7 +21,7 @@ import gradio as gr
|
|
| 21 |
import torch
|
| 22 |
from pipeline_stable_diffusion_3_ipa import StableDiffusion3Pipeline
|
| 23 |
import os
|
| 24 |
-
|
| 25 |
import spaces
|
| 26 |
from huggingface_hub import login
|
| 27 |
token = os.getenv("HF_TOKEN")
|
|
@@ -48,6 +48,8 @@ pipe.init_ipadapter(
|
|
| 48 |
|
| 49 |
@spaces.GPU
|
| 50 |
def gui_generation(prompt, ref_img, guidance_scale, ipadapter_scale):
|
|
|
|
|
|
|
| 51 |
with torch.no_grad():
|
| 52 |
# Ensure the pipeline runs with correct dtype and device
|
| 53 |
image = pipe(
|
|
@@ -70,7 +72,7 @@ with gr.Blocks() as demo:
|
|
| 70 |
prompt_box = gr.Textbox(label="Prompt", placeholder="Enter your image generation prompt")
|
| 71 |
|
| 72 |
with gr.Row():
|
| 73 |
-
ref_img = gr.Image(type="
|
| 74 |
|
| 75 |
with gr.Row():
|
| 76 |
guidance_slider = gr.Slider(
|
|
|
|
| 21 |
import torch
|
| 22 |
from pipeline_stable_diffusion_3_ipa import StableDiffusion3Pipeline
|
| 23 |
import os
|
| 24 |
+
from PIL import Image
|
| 25 |
import spaces
|
| 26 |
from huggingface_hub import login
|
| 27 |
token = os.getenv("HF_TOKEN")
|
|
|
|
| 48 |
|
| 49 |
@spaces.GPU
|
| 50 |
def gui_generation(prompt, ref_img, guidance_scale, ipadapter_scale):
|
| 51 |
+
ref_img = Image.open(ref_img).convert('RGB')
|
| 52 |
+
|
| 53 |
with torch.no_grad():
|
| 54 |
# Ensure the pipeline runs with correct dtype and device
|
| 55 |
image = pipe(
|
|
|
|
| 72 |
prompt_box = gr.Textbox(label="Prompt", placeholder="Enter your image generation prompt")
|
| 73 |
|
| 74 |
with gr.Row():
|
| 75 |
+
ref_img = gr.Image(type="filepath", label="Upload Reference Image")
|
| 76 |
|
| 77 |
with gr.Row():
|
| 78 |
guidance_slider = gr.Slider(
|