Spaces:
Runtime error
Runtime error
Delete app.py
Browse files
app.py
DELETED
@@ -1,32 +0,0 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
from diffusers import DiffusionPipeline
|
3 |
-
import torch
|
4 |
-
from PIL import Image
|
5 |
-
|
6 |
-
# Load the pipeline
|
7 |
-
prj_path = "jkcg/furniture-chair"
|
8 |
-
model = "stabilityai/stable-diffusion-xl-base-1.0"
|
9 |
-
pipe = DiffusionPipeline.from_pretrained(
|
10 |
-
model,
|
11 |
-
torch_dtype=torch.float32, # Use float32 for CPU
|
12 |
-
)
|
13 |
-
pipe.to("cpu") # Ensure the pipeline runs on CPU
|
14 |
-
pipe.load_lora_weights(prj_path, weight_name="pytorch_lora_weights.safetensors")
|
15 |
-
|
16 |
-
def generate_image(prompt, seed):
|
17 |
-
generator = torch.Generator("cpu").manual_seed(seed)
|
18 |
-
image = pipe(prompt=prompt, generator=generator).images[0]
|
19 |
-
return image
|
20 |
-
|
21 |
-
# Create the Gradio interface
|
22 |
-
interface = gr.Interface(
|
23 |
-
fn=generate_image,
|
24 |
-
inputs=[
|
25 |
-
gr.Textbox(label="Prompt", value="photo of a furnichair-texx in an empty room"),
|
26 |
-
gr.Slider(label="Seed", minimum=0, maximum=10000, step=1, value=42)
|
27 |
-
],
|
28 |
-
outputs=gr.Image(label="Generated Image")
|
29 |
-
)
|
30 |
-
|
31 |
-
# Launch the interface
|
32 |
-
interface.launch(share=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|