AMRDIAB20 commited on
Commit
2c20294
·
verified ·
1 Parent(s): 3217fa8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -4,15 +4,15 @@ import torch
4
 
5
  pipe = DiffusionPipeline.from_pretrained(
6
  "AMRDIAB20/sd15-charify-merged",
7
- torch_dtype=torch.float32 # ✅ لأن مفيش CUDA
8
- ).to("cpu") # ✅ شغّل على CPU
9
 
10
- def generate(prompt, steps, guidance):
11
  image = pipe(
12
  prompt,
13
- num_inference_steps=steps,
14
  guidance_scale=guidance,
15
- height=512, # ✅ مقاس الصورة
16
  width=512
17
  ).images[0]
18
  return image
@@ -20,8 +20,7 @@ def generate(prompt, steps, guidance):
20
  gr.Interface(
21
  fn=generate,
22
  inputs=[
23
- gr.Textbox(label="Prompt", value="Charify-style, cartoon character,"),
24
- gr.Slider(10, 30, value=20, label="Inference Steps"), # ✅ قلل الخطوات الافتراضية
25
  gr.Slider(1.0, 12.0, value=7.5, label="Guidance Scale")
26
  ],
27
  outputs=gr.Image(type="pil"),
 
4
 
5
  pipe = DiffusionPipeline.from_pretrained(
6
  "AMRDIAB20/sd15-charify-merged",
7
+ torch_dtype=torch.float32
8
+ ).to("cpu")
9
 
10
+ def generate(prompt, guidance):
11
  image = pipe(
12
  prompt,
13
+ num_inference_steps=30, # ✅ ثابت في الكود، مش ظاهر في الواجهة
14
  guidance_scale=guidance,
15
+ height=512,
16
  width=512
17
  ).images[0]
18
  return image
 
20
  gr.Interface(
21
  fn=generate,
22
  inputs=[
23
+ gr.Textbox(label="Prompt", value="Charify-style, cartoon character"),
 
24
  gr.Slider(1.0, 12.0, value=7.5, label="Guidance Scale")
25
  ],
26
  outputs=gr.Image(type="pil"),