This Pull Request improves the interface for the user

#29
Files changed (1) hide show
  1. app.py +18 -16
app.py CHANGED
@@ -61,13 +61,13 @@ frame_interpolation_model = load_rife_model("model_rife")
61
 
62
  sys_prompt = """You are part of a team of bots that creates videos. You work with an assistant bot that will draw anything you say in square brackets.
63
 
64
- For example , outputting " a beautiful morning in the woods with the sun peaking through the trees " will trigger your partner bot to output an video of a forest morning , as described. You will be prompted by people looking to create detailed , amazing videos. The way to accomplish this is to take their short prompts and make them extremely detailed and descriptive.
65
  There are a few rules to follow:
66
 
67
  You will only ever output a single video description per user request.
68
 
69
- When modifications are requested , you should not simply make the description longer . You should refactor the entire description to integrate the suggestions.
70
- Other times the user will not want modifications , but instead want a new image . In this case , you should ignore your previous conversation with the user.
71
 
72
  Video descriptions must have the same num of words as examples below. Extra words will be ignored.
73
  """
@@ -331,37 +331,39 @@ with gr.Blocks() as demo:
331
  """)
332
  with gr.Row():
333
  with gr.Column():
334
- with gr.Accordion("I2V: Image Input (cannot be used simultaneously with video input)", open=False):
335
- image_input = gr.Image(label="Input Image (will be cropped to 720 * 480)")
336
- examples_component_images = gr.Examples(examples_images, inputs=[image_input], cache_examples=False)
337
- with gr.Accordion("V2V: Video Input (cannot be used simultaneously with image input)", open=False):
338
- video_input = gr.Video(label="Input Video (will be cropped to 49 frames, 6 seconds at 8fps)")
339
- strength = gr.Slider(0.1, 1.0, value=0.8, step=0.01, label="Strength")
340
- examples_component_videos = gr.Examples(examples_videos, inputs=[video_input], cache_examples=False)
341
- prompt = gr.Textbox(label="Prompt (Less than 200 Words)", placeholder="Enter your prompt here", lines=5)
 
 
342
 
343
  with gr.Row():
344
  gr.Markdown(
345
  "✨Upon pressing the enhanced prompt button, we will use [GLM-4 Model](https://github.com/THUDM/GLM-4) to polish the prompt and overwrite the original one."
346
  )
347
- enhance_button = gr.Button("✨ Enhance Prompt(Optional)")
348
  with gr.Group():
349
  with gr.Column():
350
  with gr.Row():
351
  seed_param = gr.Number(
352
- label="Inference Seed (Enter a positive number, -1 for random)", value=-1
353
  )
354
  with gr.Row():
355
  enable_scale = gr.Checkbox(label="Super-Resolution (720 × 480 -> 2880 × 1920)", value=False)
356
  enable_rife = gr.Checkbox(label="Frame Interpolation (8fps -> 16fps)", value=False)
357
  gr.Markdown(
358
- "✨In this demo, we use [RIFE](https://github.com/hzwer/ECCV2022-RIFE) for frame interpolation and [Real-ESRGAN](https://github.com/xinntao/Real-ESRGAN) for upscaling(Super-Resolution).<br>&nbsp;&nbsp;&nbsp;&nbsp;The entire process is based on open-source solutions."
359
  )
360
 
361
- generate_button = gr.Button("🎬 Generate Video")
362
 
363
  with gr.Column():
364
- video_output = gr.Video(label="CogVideoX Generate Video", width=720, height=480)
365
  with gr.Row():
366
  download_video_button = gr.File(label="📥 Download Video", visible=False)
367
  download_gif_button = gr.File(label="📥 Download GIF", visible=False)
 
61
 
62
  sys_prompt = """You are part of a team of bots that creates videos. You work with an assistant bot that will draw anything you say in square brackets.
63
 
64
+ For example, outputting " a beautiful morning in the woods with the sun peaking through the trees " will trigger your partner bot to output an video of a forest morning, as described. You will be prompted by people looking to create detailed, amazing videos. The way to accomplish this is to take their short prompts and make them extremely detailed and descriptive.
65
  There are a few rules to follow:
66
 
67
  You will only ever output a single video description per user request.
68
 
69
+ When modifications are requested, you should not simply make the description longer. You should refactor the entire description to integrate the suggestions.
70
+ Other times the user will not want modifications, but instead want a new image. In this case, you should ignore your previous conversation with the user.
71
 
72
  Video descriptions must have the same num of words as examples below. Extra words will be ignored.
73
  """
 
331
  """)
332
  with gr.Row():
333
  with gr.Column():
334
+ with gr.Accordion("Media input (image or video, not both)", open=False):
335
+ with gr.Blocks() as media_input:
336
+ with gr.Tab("I2V: Image Input"):
337
+ image_input = gr.Image(label="Input Image (will be cropped to 720 x 480)")
338
+ examples_component_images = gr.Examples(examples_images, inputs=[image_input], cache_examples=False)
339
+ with gr.Tab("V2V: Video Input"):
340
+ video_input = gr.Video(label="Input Video (will be cropped to 49 frames, 6 seconds at 8fps)")
341
+ strength = gr.Slider(0.1, 1.0, value=0.8, step=0.01, label="Strength")
342
+ examples_component_videos = gr.Examples(examples_videos, inputs=[video_input], cache_examples=False)
343
+ prompt = gr.Textbox(label="Prompt (less than 200 Words)", placeholder="Enter your prompt here", lines=5)
344
 
345
  with gr.Row():
346
  gr.Markdown(
347
  "✨Upon pressing the enhanced prompt button, we will use [GLM-4 Model](https://github.com/THUDM/GLM-4) to polish the prompt and overwrite the original one."
348
  )
349
+ enhance_button = gr.Button("✨ Enhance Prompt (optional)")
350
  with gr.Group():
351
  with gr.Column():
352
  with gr.Row():
353
  seed_param = gr.Number(
354
+ label="Inference Seed (enter a positive number, -1 for random)", value=-1, minimum=-1
355
  )
356
  with gr.Row():
357
  enable_scale = gr.Checkbox(label="Super-Resolution (720 × 480 -> 2880 × 1920)", value=False)
358
  enable_rife = gr.Checkbox(label="Frame Interpolation (8fps -> 16fps)", value=False)
359
  gr.Markdown(
360
+ "✨In this demo, we use [RIFE](https://github.com/hzwer/ECCV2022-RIFE) for frame interpolation and [Real-ESRGAN](https://github.com/xinntao/Real-ESRGAN) for upscaling (Super-Resolution).<br>&nbsp;&nbsp;&nbsp;&nbsp;The entire process is based on open-source solutions."
361
  )
362
 
363
+ generate_button = gr.Button(value = "🎬 Generate Video", variant = "primary")
364
 
365
  with gr.Column():
366
+ video_output = gr.Video(label="CogVideoX Generate Video", width=720, height=480, autoplay = True)
367
  with gr.Row():
368
  download_video_button = gr.File(label="📥 Download Video", visible=False)
369
  download_gif_button = gr.File(label="📥 Download GIF", visible=False)