HelloSun commited on
Commit
fd971e9
·
verified ·
1 Parent(s): 02fd760

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -33
app.py CHANGED
@@ -4,43 +4,11 @@ import random
4
  from diffusers import DiffusionPipeline
5
  from optimum.intel.openvino import OVStableDiffusionPipeline
6
  import torch
7
- from typing import Callable, Dict, Optional, Tuple
8
- from diffusers import (
9
- DDIMScheduler,
10
- DPMSolverMultistepScheduler,
11
- DPMSolverSinglestepScheduler,
12
- EulerAncestralDiscreteScheduler,
13
- EulerDiscreteScheduler,
14
- )
15
-
16
- def get_scheduler(scheduler_config: Dict, name: str) -> Optional[Callable]:
17
- scheduler_factory_map = {
18
- "DPM++ 2M Karras": lambda: DPMSolverMultistepScheduler.from_config(
19
- scheduler_config, use_karras_sigmas=True
20
- ),
21
- "DPM++ SDE Karras": lambda: DPMSolverSinglestepScheduler.from_config(
22
- scheduler_config, use_karras_sigmas=True
23
- ),
24
- "DPM++ 2M SDE Karras": lambda: DPMSolverMultistepScheduler.from_config(
25
- scheduler_config, use_karras_sigmas=True, algorithm_type="sde-dpmsolver++"
26
- ),
27
- "Euler": lambda: EulerDiscreteScheduler.from_config(scheduler_config),
28
- "Euler a": lambda: EulerAncestralDiscreteScheduler.from_config(
29
- scheduler_config
30
- ),
31
- "DDIM": lambda: DDIMScheduler.from_config(scheduler_config),
32
- }
33
- return scheduler_factory_map.get(name, lambda: None)()
34
-
35
 
36
 
37
  model_id = "helenai/Linaqruf-anything-v3.0-ov"
38
- num_inference_steps = 25
39
- sampler = "Euler a"
40
-
41
  pipe = OVStableDiffusionPipeline.from_pretrained(model_id, compile=False)
42
  pipe.reshape( batch_size=1, height=256, width=256, num_images_per_prompt=1)
43
- pipe.scheduler = get_scheduler(pipe.scheduler.config, sampler)
44
 
45
  pipe.compile()
46
 
@@ -64,7 +32,6 @@ def infer(prompt,negative_prompt):
64
  (((mutation))), ((mutilated)), (out of frame), ((poorly drawn face)), poorly drawn feet, \
65
  ((poorly drawn hands)), tiling, (too many fingers), ((ugly)), wierd colors, (((long neck))), \
66
  ugly, words, wrinkles, writing",
67
- num_inference_steps=num_inference_steps,
68
  width = 256,
69
  height = 256,
70
  ).images[0]
 
4
  from diffusers import DiffusionPipeline
5
  from optimum.intel.openvino import OVStableDiffusionPipeline
6
  import torch
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
 
9
  model_id = "helenai/Linaqruf-anything-v3.0-ov"
 
 
 
10
  pipe = OVStableDiffusionPipeline.from_pretrained(model_id, compile=False)
11
  pipe.reshape( batch_size=1, height=256, width=256, num_images_per_prompt=1)
 
12
 
13
  pipe.compile()
14
 
 
32
  (((mutation))), ((mutilated)), (out of frame), ((poorly drawn face)), poorly drawn feet, \
33
  ((poorly drawn hands)), tiling, (too many fingers), ((ugly)), wierd colors, (((long neck))), \
34
  ugly, words, wrinkles, writing",
 
35
  width = 256,
36
  height = 256,
37
  ).images[0]