ChenDY commited on
Commit
e71610b
1 Parent(s): f31a574

add fixed inference steps and title

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -51,7 +51,7 @@ scheduler_vibrant.config.original_inference_steps = 4
51
 
52
 
53
  @spaces.GPU
54
- def process_image(model_choice, num_images, height, width, prompt, seed):
55
  global pipe
56
  # Switch to the selected model
57
  if model_choice == "NitroSD-Realism":
@@ -67,7 +67,7 @@ def process_image(model_choice, num_images, height, width, prompt, seed):
67
  return pipe(
68
  prompt=[prompt] * num_images,
69
  generator=torch.manual_seed(int(seed)),
70
- num_inference_steps=1,
71
  guidance_scale=0.0,
72
  height=int(height),
73
  width=int(width),
@@ -79,6 +79,9 @@ with gr.Blocks() as demo:
79
  with gr.Column():
80
  with gr.Row():
81
  with gr.Column():
 
 
 
82
  model_choice = gr.Dropdown(
83
  label="Choose Model",
84
  choices=["NitroSD-Realism", "NitroSD-Vibrant"],
@@ -96,11 +99,16 @@ with gr.Blocks() as demo:
96
  )
97
  prompt = gr.Text(label="Prompt", value="a photo of a cat", interactive=True)
98
  seed = gr.Number(label="Seed", value=2024, interactive=True)
 
99
  btn = gr.Button(value="Generate Image")
100
  with gr.Column():
101
  output = gr.Gallery(height=1024)
102
 
103
- btn.click(process_image, inputs=[model_choice, num_images, height, width, prompt, seed], outputs=[output])
 
 
 
 
104
 
105
  if __name__ == "__main__":
106
  demo.launch()
 
51
 
52
 
53
  @spaces.GPU
54
+ def process_image(model_choice, num_images, height, width, prompt, seed, inference_steps):
55
  global pipe
56
  # Switch to the selected model
57
  if model_choice == "NitroSD-Realism":
 
67
  return pipe(
68
  prompt=[prompt] * num_images,
69
  generator=torch.manual_seed(int(seed)),
70
+ num_inference_steps=inference_steps,
71
  guidance_scale=0.0,
72
  height=int(height),
73
  width=int(width),
 
79
  with gr.Column():
80
  with gr.Row():
81
  with gr.Column():
82
+ gr.Markdown("""
83
+ ### NitroFusion Single-Step Text-To-Image
84
+ """)
85
  model_choice = gr.Dropdown(
86
  label="Choose Model",
87
  choices=["NitroSD-Realism", "NitroSD-Vibrant"],
 
99
  )
100
  prompt = gr.Text(label="Prompt", value="a photo of a cat", interactive=True)
101
  seed = gr.Number(label="Seed", value=2024, interactive=True)
102
+ inference_steps = gr.Number(label="Inference Steps", value=1, interactive=False)
103
  btn = gr.Button(value="Generate Image")
104
  with gr.Column():
105
  output = gr.Gallery(height=1024)
106
 
107
+ btn.click(
108
+ process_image,
109
+ inputs=[model_choice, num_images, height, width, prompt, seed, inference_steps],
110
+ outputs=[output],
111
+ )
112
 
113
  if __name__ == "__main__":
114
  demo.launch()