hsuwill000 commited on
Commit
14b405b
·
verified ·
1 Parent(s): 0ce36a3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -22
app.py CHANGED
@@ -1,26 +1,9 @@
1
  import gradio as gr
2
- import numpy as np
3
- import random
4
- from diffusers import DiffusionPipeline
5
- from optimum.intel.openvino.modeling_diffusion import OVModelVaeDecoder, OVBaseModel, OVStableDiffusionPipeline
6
  import torch
7
- from huggingface_hub import snapshot_download
8
- import openvino.runtime as ov
9
- from typing import Optional, Dict
10
- from diffusers import EulerAncestralDiscreteScheduler, LCMScheduler, DDIMScheduler
11
-
12
-
13
-
14
- #EulerDiscreteScheduler 尚可
15
- #EulerAncestralDiscreteScheduler
16
-
17
 
18
  model_id = "hsuwill000/LCM-absolutereality-openvino-8bit"
19
 
20
- #model_id = "spamsoms/LCM-anything-v5-openvino2"
21
- #adapter_id = "latent-consistency/lcm-lora-sdv1-5"
22
-
23
-
24
  HIGH=1024
25
  WIDTH=512
26
 
@@ -33,8 +16,6 @@ pipe = OVStableDiffusionPipeline.from_pretrained(
33
  compile = False,
34
  ov_config = {"CACHE_DIR":""},
35
  torch_dtype=torch.uint8,
36
- #variant="fp16",
37
- #torch_dtype=torch.IntTensor, #慢,
38
  safety_checker=None,
39
  use_safetensors=False,
40
  )
@@ -46,12 +27,12 @@ pipe.reshape( batch_size=-1, height=HIGH, width=WIDTH, num_images_per_prompt=1)
46
  pipe.compile()
47
 
48
  prompt=""
49
- negative_prompt="EasyNegative, cartoonish, low resolution, blurry, simplistic, abstract, deformed, ugly,"
50
 
51
  def infer(prompt,negative_prompt):
52
 
53
  image = pipe(
54
- prompt = prompt+",hyper-realistic 2K image of {prompt}. ultra-detailed, lifelike, high-resolution, sharp, vibrant colors, photorealistic, ",
55
  negative_prompt = negative_prompt,
56
  width = WIDTH,
57
  height = HIGH,
 
1
  import gradio as gr
2
+ from optimum.intel.openvino.modeling_diffusion import OVStableDiffusionPipeline
 
 
 
3
  import torch
 
 
 
 
 
 
 
 
 
 
4
 
5
  model_id = "hsuwill000/LCM-absolutereality-openvino-8bit"
6
 
 
 
 
 
7
  HIGH=1024
8
  WIDTH=512
9
 
 
16
  compile = False,
17
  ov_config = {"CACHE_DIR":""},
18
  torch_dtype=torch.uint8,
 
 
19
  safety_checker=None,
20
  use_safetensors=False,
21
  )
 
27
  pipe.compile()
28
 
29
  prompt=""
30
+ negative_prompt=f"EasyNegative, cartoonish, low resolution, blurry, simplistic, abstract, deformed, ugly,"
31
 
32
  def infer(prompt,negative_prompt):
33
 
34
  image = pipe(
35
+ prompt = f",hyper-realistic 2K image of {prompt}. ultra-detailed, lifelike, high-resolution, sharp, vibrant colors, photorealistic, ",
36
  negative_prompt = negative_prompt,
37
  width = WIDTH,
38
  height = HIGH,