Teotonix commited on
Commit
e547b62
·
verified ·
1 Parent(s): e2a5470

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -28,15 +28,18 @@ def chat_fn(message, history):
28
  return tokenizer.decode(output[0], skip_special_tokens=True)
29
 
30
  # ---------------- IMAGE ----------------
 
 
 
31
  img_pipe = StableDiffusionPipeline.from_pretrained(
32
  "runwayml/stable-diffusion-v1-5",
33
  torch_dtype=torch.float32,
34
  safety_checker=None
35
  )
36
 
37
- img_pipe.set_progress_bar_config(disable=True)
38
  img_pipe = img_pipe.to("cpu")
39
 
 
40
  def generate_image(prompt):
41
  if not prompt.strip():
42
  raise gr.Error("Prompt boş")
@@ -45,12 +48,14 @@ def generate_image(prompt):
45
  prompt,
46
  height=512,
47
  width=512,
48
- num_inference_steps=12
 
49
  ).images[0]
50
 
51
  return image
52
 
53
 
 
54
  # ---------------- UI ----------------
55
  import gradio as gr
56
 
 
28
  return tokenizer.decode(output[0], skip_special_tokens=True)
29
 
30
  # ---------------- IMAGE ----------------
31
+ from diffusers import StableDiffusionPipeline
32
+ import torch
33
+
34
  img_pipe = StableDiffusionPipeline.from_pretrained(
35
  "runwayml/stable-diffusion-v1-5",
36
  torch_dtype=torch.float32,
37
  safety_checker=None
38
  )
39
 
 
40
  img_pipe = img_pipe.to("cpu")
41
 
42
+
43
  def generate_image(prompt):
44
  if not prompt.strip():
45
  raise gr.Error("Prompt boş")
 
48
  prompt,
49
  height=512,
50
  width=512,
51
+ num_inference_steps=10, # 🔥 hız
52
+ guidance_scale=7
53
  ).images[0]
54
 
55
  return image
56
 
57
 
58
+
59
  # ---------------- UI ----------------
60
  import gradio as gr
61