radames commited on
Commit
3ceb728
1 Parent(s): 9b6cd91

updates on change

Browse files
Files changed (1) hide show
  1. app.py +11 -10
app.py CHANGED
@@ -46,9 +46,9 @@ MAX_SEED = np.iinfo(np.int32).max
46
  MAX_IMAGE_SIZE = 1024
47
  NUM_INFERENCE_STEPS = 4
48
 
 
49
  @spaces.GPU
50
  def infer(prompt, seed, randomize_seed):
51
-
52
  if randomize_seed:
53
  seed = random.randint(0, MAX_SEED)
54
 
@@ -89,7 +89,6 @@ else:
89
  power_device = "CPU"
90
 
91
  with gr.Blocks(css=css) as demo:
92
-
93
  with gr.Column(elem_id="col-container"):
94
  gr.Markdown(
95
  f"""
@@ -105,7 +104,6 @@ with gr.Blocks(css=css) as demo:
105
  )
106
 
107
  with gr.Row():
108
-
109
  prompt = gr.Text(
110
  label="Prompt",
111
  show_label=False,
@@ -119,7 +117,6 @@ with gr.Blocks(css=css) as demo:
119
  result = gr.Image(label="Result", show_label=False)
120
 
121
  with gr.Accordion("Advanced Settings", open=False):
122
-
123
  seed = gr.Slider(
124
  label="Seed",
125
  minimum=0,
@@ -132,14 +129,18 @@ with gr.Blocks(css=css) as demo:
132
 
133
  examples = gr.Examples(examples=examples, inputs=[prompt])
134
 
135
- gr.Markdown(
136
- "**Disclaimer:**"
137
- )
138
  gr.Markdown(
139
  "This demo is only for research purpose. Jasper cannot be held responsible for the generation of NSFW (Not Safe For Work) content through the use of this demo. Users are solely responsible for any content they create, and it is their obligation to ensure that it adheres to appropriate and ethical standards. Jasper provides the tools, but the responsibility for their use lies with the individual user."
140
  )
141
-
142
- run_button.click(fn=infer, inputs=[prompt, seed, randomize_seed], outputs=[result])
143
- seed.change(fn=infer, inputs=[prompt, seed, randomize_seed], outputs=[result])
 
 
 
 
 
 
144
 
145
  demo.queue().launch(show_api=False)
 
46
  MAX_IMAGE_SIZE = 1024
47
  NUM_INFERENCE_STEPS = 4
48
 
49
+
50
  @spaces.GPU
51
  def infer(prompt, seed, randomize_seed):
 
52
  if randomize_seed:
53
  seed = random.randint(0, MAX_SEED)
54
 
 
89
  power_device = "CPU"
90
 
91
  with gr.Blocks(css=css) as demo:
 
92
  with gr.Column(elem_id="col-container"):
93
  gr.Markdown(
94
  f"""
 
104
  )
105
 
106
  with gr.Row():
 
107
  prompt = gr.Text(
108
  label="Prompt",
109
  show_label=False,
 
117
  result = gr.Image(label="Result", show_label=False)
118
 
119
  with gr.Accordion("Advanced Settings", open=False):
 
120
  seed = gr.Slider(
121
  label="Seed",
122
  minimum=0,
 
129
 
130
  examples = gr.Examples(examples=examples, inputs=[prompt])
131
 
132
+ gr.Markdown("**Disclaimer:**")
 
 
133
  gr.Markdown(
134
  "This demo is only for research purpose. Jasper cannot be held responsible for the generation of NSFW (Not Safe For Work) content through the use of this demo. Users are solely responsible for any content they create, and it is their obligation to ensure that it adheres to appropriate and ethical standards. Jasper provides the tools, but the responsibility for their use lies with the individual user."
135
  )
136
+ gr.on(
137
+ [run_button.click, seed.change, prompt.change, randomize_seed.change],
138
+ fn=infer,
139
+ inputs=[prompt, seed, randomize_seed],
140
+ outputs=[result],
141
+ show_progress="minimal",
142
+ show_api=False,
143
+ trigger_mode="always_last",
144
+ )
145
 
146
  demo.queue().launch(show_api=False)