aifeifei798 commited on
Commit
da5c76d
·
verified ·
1 Parent(s): 1725cda

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -7,6 +7,9 @@ from diffusers import DiffusionPipeline, AutoencoderTiny
7
  from huggingface_hub import hf_hub_download
8
 
9
  import config
 
 
 
10
 
11
  def feifeimodload():
12
 
@@ -29,12 +32,8 @@ def feifeimodload():
29
 
30
  pipe = feifeimodload()
31
 
32
-
33
- MAX_SEED = np.iinfo(np.int32).max
34
- MAX_IMAGE_SIZE = 2048
35
-
36
  @spaces.GPU()
37
- def infer(prompt, seed=42, randomize_seed=False, width=1024, height=1024, num_inference_steps=4, progress=gr.Progress(track_tqdm=True)):
38
  if randomize_seed:
39
  seed = random.randint(0, MAX_SEED)
40
  generator = torch.Generator().manual_seed(seed)
@@ -92,7 +91,6 @@ DarkIdol-flux is a text-to-image AI model designed to create aesthetic, detailed
92
  value="",
93
  )
94
  with gr.Row():
95
- styles_name = [style["name"] for style in config.style_list]
96
  styles_Radio = gr.Dropdown(
97
  styles_name,
98
  label="Styles",
@@ -155,7 +153,7 @@ DarkIdol-flux is a text-to-image AI model designed to create aesthetic, detailed
155
  gr.on(
156
  triggers=[run_button.click, prompt.submit],
157
  fn = infer,
158
- inputs = [prompt, seed, randomize_seed, width, height, num_inference_steps],
159
  outputs = [result, seed]
160
  )
161
 
 
7
  from huggingface_hub import hf_hub_download
8
 
9
  import config
10
+ styles_name = [style["name"] for style in config.style_list]
11
+ MAX_SEED = np.iinfo(np.int32).max
12
+ MAX_IMAGE_SIZE = 2048
13
 
14
  def feifeimodload():
15
 
 
32
 
33
  pipe = feifeimodload()
34
 
 
 
 
 
35
  @spaces.GPU()
36
+ def infer(prompt, styles_Radio="(None)", seed=42, randomize_seed=False, width=1024, height=1024, num_inference_steps=4, progress=gr.Progress(track_tqdm=True)):
37
  if randomize_seed:
38
  seed = random.randint(0, MAX_SEED)
39
  generator = torch.Generator().manual_seed(seed)
 
91
  value="",
92
  )
93
  with gr.Row():
 
94
  styles_Radio = gr.Dropdown(
95
  styles_name,
96
  label="Styles",
 
153
  gr.on(
154
  triggers=[run_button.click, prompt.submit],
155
  fn = infer,
156
+ inputs = [prompt, styles_Radio, seed, randomize_seed, width, height, num_inference_steps],
157
  outputs = [result, seed]
158
  )
159