Spaces:
Runtime error
Runtime error
cuneytkaya
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ from diffusers import StableDiffusionImg2ImgPipeline
|
|
3 |
import torch
|
4 |
from PIL import Image
|
5 |
|
6 |
-
|
7 |
model_id = "CompVis/stable-diffusion-v1-4"
|
8 |
pipe = StableDiffusionImg2ImgPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
|
9 |
pipe = pipe.to("cuda" if torch.cuda.is_available() else "cpu")
|
@@ -14,13 +14,20 @@ def stylize_image(input_image, prompt):
|
|
14 |
output = pipe(prompt=prompt, image=input_image, strength=0.75).images[0]
|
15 |
return output
|
16 |
|
17 |
-
|
18 |
iface = gr.Interface(
|
19 |
fn=stylize_image,
|
20 |
-
inputs=[
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
)
|
25 |
|
26 |
-
iface.launch()
|
|
|
|
3 |
import torch
|
4 |
from PIL import Image
|
5 |
|
6 |
+
|
7 |
model_id = "CompVis/stable-diffusion-v1-4"
|
8 |
pipe = StableDiffusionImg2ImgPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
|
9 |
pipe = pipe.to("cuda" if torch.cuda.is_available() else "cpu")
|
|
|
14 |
output = pipe(prompt=prompt, image=input_image, strength=0.75).images[0]
|
15 |
return output
|
16 |
|
17 |
+
|
18 |
iface = gr.Interface(
|
19 |
fn=stylize_image,
|
20 |
+
inputs=[
|
21 |
+
gr.Image(type="pil", label="Upload your image"), # English label for image upload
|
22 |
+
gr.Textbox(placeholder="Enter the art style... (e.g., Van Gogh style)", label="Art Style", lines=1) # English label and example prompt
|
23 |
+
],
|
24 |
+
outputs=gr.Image(label="Stylized Image"), # English label for output
|
25 |
+
title="Art and Style Transfer Demo", # English title
|
26 |
+
description="This demo uses the Stable Diffusion model to transform an image into a specified art style. Upload an image and enter a style prompt to get started.",
|
27 |
+
examples=[
|
28 |
+
["example_image.jpg", "Van Gogh style"],
|
29 |
+
]
|
30 |
)
|
31 |
|
32 |
+
iface.launch(share=True)
|
33 |
+
|