cuneytkaya commited on
Commit
ccbe187
1 Parent(s): 8cf6fe4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -7
app.py CHANGED
@@ -3,7 +3,7 @@ from diffusers import StableDiffusionImg2ImgPipeline
3
  import torch
4
  from PIL import Image
5
 
6
- # Stable Diffusion img2img modelini yükleme
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
- # Gradio arayüzünü oluşturma
18
  iface = gr.Interface(
19
  fn=stylize_image,
20
- inputs=[gr.Image(type="pil"), gr.Textbox(placeholder="Sanat tarzını girin...")],
21
- outputs="image",
22
- title="Sanat ve Stil Transferi Demo",
23
- description="Bu demo, bir görüntüyü belirttiğiniz sanat tarzına dönüştürmek için Stable Diffusion modelini kullanır."
 
 
 
 
 
 
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
+