zw89 commited on
Commit
2aed1c2
·
verified ·
1 Parent(s): 5bb1775

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -5
app.py CHANGED
@@ -2,20 +2,27 @@ import gradio as gr
2
  from diffusers import StableDiffusionPipeline
3
  import torch
4
 
5
- # Ссылка на конкретный файл модели
6
  model_url = "https://huggingface.co/XpucT/Deliberate/blob/main/Deliberate_v3.safetensors"
7
 
8
- # Загружаем модель из одного файла (подходит для CPU)
9
  pipe = StableDiffusionPipeline.from_single_file(
10
  model_url,
11
  torch_dtype=torch.float32
12
  )
13
 
14
  def generate(prompt):
15
- # 20 шагов — оптимально для бесплатного CPU
16
  image = pipe(prompt, num_inference_steps=20).images
17
  return image
18
 
19
  # Создаем интерфейс
20
- demo = gr.Interface(fn=generate, inputs="text", outputs="image", title="Deliberate V3")
21
- demo.queue().launch(show_api=False, ssr_mode=False)
 
 
 
 
 
 
 
 
2
  from diffusers import StableDiffusionPipeline
3
  import torch
4
 
5
+ # Прямая ссылка на твою модель
6
  model_url = "https://huggingface.co/XpucT/Deliberate/blob/main/Deliberate_v3.safetensors"
7
 
8
+ # Загружаем модель
9
  pipe = StableDiffusionPipeline.from_single_file(
10
  model_url,
11
  torch_dtype=torch.float32
12
  )
13
 
14
  def generate(prompt):
15
+ # 20 шагов — баланс скорости и качества
16
  image = pipe(prompt, num_inference_steps=20).images
17
  return image
18
 
19
  # Создаем интерфейс
20
+ demo = gr.Interface(
21
+ fn=generate,
22
+ inputs=gr.Textbox(label="Описание картинки (на английском)"),
23
+ outputs=gr.Image(label="Результат"),
24
+ title="Deliberate V3"
25
+ )
26
+
27
+ # Запуск
28
+ demo.launch()