Spaces:
Runtime error
Runtime error
Nishant Sahu
commited on
Commit
·
dd942ed
1
Parent(s):
ffef263
Add FLUX-IP-Adapter-v2
Browse files- app.py +22 -0
- requirements.txt +4 -0
app.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from diffusers import StableDiffusionPipeline
|
| 2 |
+
|
| 3 |
+
# Load FLUX-IP-Adapter-v2
|
| 4 |
+
model_id = "XLabs-AI/flux-ip-adapter-v2"
|
| 5 |
+
pipeline = StableDiffusionPipeline.from_pretrained(model_id)
|
| 6 |
+
pipeline.to("cuda") # Use GPU if available
|
| 7 |
+
|
| 8 |
+
import gradio as gr
|
| 9 |
+
|
| 10 |
+
def generate_scene(image, prompt):
|
| 11 |
+
result = pipeline(prompt=prompt, image=image).images[0]
|
| 12 |
+
return result
|
| 13 |
+
|
| 14 |
+
interface = gr.Interface(
|
| 15 |
+
fn=generate_scene,
|
| 16 |
+
inputs=["image", "text"],
|
| 17 |
+
outputs="image",
|
| 18 |
+
title="FLUX-IP-Adapter-v2 Image Generation"
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
if __name__ == "__main__":
|
| 22 |
+
interface.launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
torch
|
| 2 |
+
transformers
|
| 3 |
+
diffusers
|
| 4 |
+
xformers
|