prithivMLmods commited on
Commit
90389b6
·
verified ·
1 Parent(s): cbf0c84

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -14
app.py CHANGED
@@ -64,14 +64,6 @@ def generate(
64
  num_images: int = 1, # Number of images to generate
65
  progress=gr.Progress(track_tqdm=True),
66
  ):
67
- # Show the loading animation
68
- loading_html = """
69
- <div id="loading-animation">
70
- <iframe src="https://prithivmlmods-hamster-static.static.hf.space/index.html" width="100%" height="200" style="border:none;"></iframe>
71
- </div>
72
- """
73
- gr.HTML.update(loading_html, visible=True)
74
-
75
  seed = int(randomize_seed_fn(seed, randomize_seed))
76
  generator = torch.Generator(device=device).manual_seed(seed)
77
 
@@ -102,10 +94,7 @@ def generate(
102
 
103
  image_paths = [save_image(img) for img in images]
104
 
105
- # Hide the loading animation
106
- gr.HTML.update("", visible=False)
107
-
108
- return image_paths, seed
109
 
110
  examples = [
111
  "a cat eating a piece of cheese",
@@ -225,7 +214,7 @@ with gr.Blocks(css=css, theme="bethecloud/storj_theme") as demo:
225
  num_inference_steps,
226
  randomize_seed,
227
  num_images
228
- ], outputs=[result, seed], queue=True)
229
 
230
  run_button.click(fn=generate, inputs=[
231
  prompt,
@@ -238,7 +227,7 @@ with gr.Blocks(css=css, theme="bethecloud/storj_theme") as demo:
238
  num_inference_steps,
239
  randomize_seed,
240
  num_images
241
- ], outputs=[result, seed], queue=True)
242
 
243
  if __name__ == "__main__":
244
  demo.queue(max_size=50).launch()
 
64
  num_images: int = 1, # Number of images to generate
65
  progress=gr.Progress(track_tqdm=True),
66
  ):
 
 
 
 
 
 
 
 
67
  seed = int(randomize_seed_fn(seed, randomize_seed))
68
  generator = torch.Generator(device=device).manual_seed(seed)
69
 
 
94
 
95
  image_paths = [save_image(img) for img in images]
96
 
97
+ return image_paths, seed, gr.update(visible=False)
 
 
 
98
 
99
  examples = [
100
  "a cat eating a piece of cheese",
 
214
  num_inference_steps,
215
  randomize_seed,
216
  num_images
217
+ ], outputs=[result, seed, loading_animation], queue=True)
218
 
219
  run_button.click(fn=generate, inputs=[
220
  prompt,
 
227
  num_inference_steps,
228
  randomize_seed,
229
  num_images
230
+ ], outputs=[result, seed, loading_animation], queue=True)
231
 
232
  if __name__ == "__main__":
233
  demo.queue(max_size=50).launch()