Badr AlKhamissi commited on
Commit
bf0a375
1 Parent(s): ffa9150

changed desc

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -58,7 +58,7 @@ TITLE="""<h1 style="font-size: 42px;" align="center">Word-To-Image: Morphing Ara
58
  DESCRIPTION="""This demo builds on the [Word-As-Image for Semantic Typography](https://wordasimage.github.io/Word-As-Image-Page/) work to support Arabic fonts and morphing whole words and phrases to a visual representation of a semantic concept. This is part of an ongoing effort with the [ARBML](https://arbml.github.io/website/) community to build open-source Arabic tools using machine learning."""
59
 
60
  # DESCRIPTION += '\n<p>This demo is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"> Creative Commons Attribution-ShareAlike 4.0 International License</a>.</p>'
61
- DESCRIPTION += '\n<p>Note: it takes about 5 minutes for 500 iterations to generate the final GIF. For faster inference without waiting in queue, you can <a href="https://colab.research.google.com/drive/1wobOAsnLpkIzaRxG5yac8NcV7iCrlycP"><img style="display: inline; margin-top: 0em; margin-bottom: 0em" src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a></p>'
62
 
63
  if (SPACE_ID := os.getenv('SPACE_ID')) is not None:
64
  DESCRIPTION = DESCRIPTION.replace("</p>", " ")
@@ -263,11 +263,11 @@ def run_main_app(semantic_concept, word, prompt_suffix, font_name, num_steps, se
263
 
264
  # combine_word(cfg.word, cfg.optimized_letter, cfg.font, cfg.experiment_dir, device)
265
 
266
- filename = os.path.join(cfg.experiment_dir, "final.mp4")
267
- writer = imageio.get_writer(filename, fps=20)
268
- for frame in gif_frames: writer.append_data(frame)
269
- writer.close()
270
- # imageio.mimsave(filename, np.array(gif_frames).astype(np.uint8))
271
 
272
  yield gr.update(value=filename_init,visible=True),gr.update(visible=False),gr.update(value=filename,visible=True)
273
 
@@ -365,7 +365,7 @@ with gr.Blocks() as demo:
365
  with gr.Column():
366
  result0 = gr.Image(type="filepath", label="Initial Word").style(height=250)
367
  result1 = gr.Image(type="filepath", label="Optimization Process").style(height=300)
368
- result2 = gr.Video(type="filepath", label="Final Result",visible=False).style(height=300)
369
 
370
 
371
  with gr.Row():
 
58
  DESCRIPTION="""This demo builds on the [Word-As-Image for Semantic Typography](https://wordasimage.github.io/Word-As-Image-Page/) work to support Arabic fonts and morphing whole words and phrases to a visual representation of a semantic concept. This is part of an ongoing effort with the [ARBML](https://arbml.github.io/website/) community to build open-source Arabic tools using machine learning."""
59
 
60
  # DESCRIPTION += '\n<p>This demo is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"> Creative Commons Attribution-ShareAlike 4.0 International License</a>.</p>'
61
+ DESCRIPTION += '\n<p>Note: it takes about 5 minutes for 250 iterations to generate the final GIF. For faster inference without waiting in queue, you can <a href="https://colab.research.google.com/drive/1wobOAsnLpkIzaRxG5yac8NcV7iCrlycP"><img style="display: inline; margin-top: 0em; margin-bottom: 0em" src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a></p>'
62
 
63
  if (SPACE_ID := os.getenv('SPACE_ID')) is not None:
64
  DESCRIPTION = DESCRIPTION.replace("</p>", " ")
 
263
 
264
  # combine_word(cfg.word, cfg.optimized_letter, cfg.font, cfg.experiment_dir, device)
265
 
266
+ filename = os.path.join(cfg.experiment_dir, "final.gif")
267
+ # writer = imageio.get_writer(filename, fps=20)
268
+ # for frame in gif_frames: writer.append_data(frame)
269
+ # writer.close()
270
+ imageio.mimsave(filename, np.array(gif_frames).astype(np.uint8))
271
 
272
  yield gr.update(value=filename_init,visible=True),gr.update(visible=False),gr.update(value=filename,visible=True)
273
 
 
365
  with gr.Column():
366
  result0 = gr.Image(type="filepath", label="Initial Word").style(height=250)
367
  result1 = gr.Image(type="filepath", label="Optimization Process").style(height=300)
368
+ result2 = gr.Image(type="filepath", label="Final GIF",visible=False).style(height=300)
369
 
370
 
371
  with gr.Row():