multimodalart HF staff commited on
Commit
091f1bb
1 Parent(s): 2a96176

Update app/hydit_app.py

Browse files
Files changed (1) hide show
  1. app/hydit_app.py +5 -3
app/hydit_app.py CHANGED
@@ -12,6 +12,7 @@ sys.path.insert(0, str(Path(__file__).parent.parent))
12
 
13
  from hydit.constants import SAMPLER_FACTORY
14
  from sample_t2i import inferencer
 
15
 
16
  ROOT = Path(__file__).parent.parent
17
  SAMPLERS = list(SAMPLER_FACTORY.keys())
@@ -31,7 +32,7 @@ def get_strings(lang):
31
  args, gen, enhancer = inferencer()
32
  strings = get_strings("en")
33
 
34
-
35
  def infer(
36
  prompt,
37
  negative_prompt,
@@ -41,7 +42,8 @@ def infer(
41
  oriW, oriH,
42
  sampler,
43
  size,
44
- enhance
 
45
  ):
46
  if enhance and enhancer is not None:
47
  success, enhanced_prompt = enhancer(prompt)
@@ -95,7 +97,7 @@ def ui():
95
  prompt = gr.Textbox(label=strings['prompt'], value=strings['default prompt'], lines=3)
96
  with gr.Row():
97
  infer_steps = gr.Slider(
98
- label=strings['infer steps'], minimum=1, maximum=200, value=100, step=1,
99
  )
100
  seed = gr.Number(
101
  label=strings['seed'], minimum=-1, maximum=1_000_000_000, value=1, step=1, precision=0,
 
12
 
13
  from hydit.constants import SAMPLER_FACTORY
14
  from sample_t2i import inferencer
15
+ import spaces
16
 
17
  ROOT = Path(__file__).parent.parent
18
  SAMPLERS = list(SAMPLER_FACTORY.keys())
 
32
  args, gen, enhancer = inferencer()
33
  strings = get_strings("en")
34
 
35
+ @spaces.GPU
36
  def infer(
37
  prompt,
38
  negative_prompt,
 
42
  oriW, oriH,
43
  sampler,
44
  size,
45
+ enhance,
46
+ progress=gr.Progress(track_tqdm=True)
47
  ):
48
  if enhance and enhancer is not None:
49
  success, enhanced_prompt = enhancer(prompt)
 
97
  prompt = gr.Textbox(label=strings['prompt'], value=strings['default prompt'], lines=3)
98
  with gr.Row():
99
  infer_steps = gr.Slider(
100
+ label=strings['infer steps'], minimum=1, maximum=200, value=50, step=1,
101
  )
102
  seed = gr.Number(
103
  label=strings['seed'], minimum=-1, maximum=1_000_000_000, value=1, step=1, precision=0,