Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,16 +2,17 @@ import gradio as gr
|
|
| 2 |
import torch
|
| 3 |
from diffusers import KolorsPipeline
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
|
|
|
| 10 |
|
| 11 |
# Function to generate image from prompt
|
| 12 |
def generate_image(prompt):
|
| 13 |
# Use the pipeline to generate an image from the text prompt
|
| 14 |
-
image =
|
| 15 |
return image
|
| 16 |
|
| 17 |
# Create Gradio interface
|
|
|
|
| 2 |
import torch
|
| 3 |
from diffusers import KolorsPipeline
|
| 4 |
|
| 5 |
+
from diffusers import FluxPipeline
|
| 6 |
+
|
| 7 |
+
pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16)
|
| 8 |
+
pipe.load_lora_weights("Shakker-Labs/FLUX.1-dev-LoRA-Logo-Design", weight_name="FLUX-dev-lora-Logo-Design.safetensors")
|
| 9 |
+
pipe.fuse_lora(lora_scale=0.8)
|
| 10 |
+
pipe.to("cuda" if torch.cuda.is_available() else "cpu")
|
| 11 |
|
| 12 |
# Function to generate image from prompt
|
| 13 |
def generate_image(prompt):
|
| 14 |
# Use the pipeline to generate an image from the text prompt
|
| 15 |
+
image = pipe(prompt).images[0]
|
| 16 |
return image
|
| 17 |
|
| 18 |
# Create Gradio interface
|