robin-courant commited on
Commit
361d4aa
1 Parent(s): ad09640

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -7
app.py CHANGED
@@ -142,8 +142,7 @@ def generate(
142
  # ------------------------------------------------------------------------------------- #
143
 
144
 
145
- @spaces.GPU
146
- def main(gen_fn: Callable):
147
  theme = gr.themes.Default(primary_hue="blue", secondary_hue="gray")
148
 
149
  with gr.Blocks(theme=theme) as demo:
@@ -203,10 +202,8 @@ def main(gen_fn: Callable):
203
  demo.queue().launch(share=False)
204
 
205
 
206
- # ------------------------------------------------------------------------------------- #
207
-
208
-
209
- if __name__ == "__main__":
210
  # Initialize the models and dataset
211
  diffuser, clip_model, dataset, device = init("config")
212
  generate_sample = partial(
@@ -217,4 +214,11 @@ if __name__ == "__main__":
217
  clip_model=clip_model,
218
  )
219
 
220
- main(generate_sample)
 
 
 
 
 
 
 
 
142
  # ------------------------------------------------------------------------------------- #
143
 
144
 
145
+ def launch_app(gen_fn: Callable):
 
146
  theme = gr.themes.Default(primary_hue="blue", secondary_hue="gray")
147
 
148
  with gr.Blocks(theme=theme) as demo:
 
202
  demo.queue().launch(share=False)
203
 
204
 
205
+ @spaces.GPU
206
+ def main():
 
 
207
  # Initialize the models and dataset
208
  diffuser, clip_model, dataset, device = init("config")
209
  generate_sample = partial(
 
214
  clip_model=clip_model,
215
  )
216
 
217
+ launch_app(generate_sample)
218
+
219
+
220
+ # ------------------------------------------------------------------------------------- #
221
+
222
+
223
+ if __name__ == "__main__":
224
+ main()