ysharma HF Staff commited on
Commit
e4e75af
·
1 Parent(s): fb8b0fe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -5
app.py CHANGED
@@ -35,16 +35,39 @@ with gr.Blocks() as demo:
35
  with gr.Row():
36
  with gr.Column():
37
  text_in = gr.Textbox(label="文本描述", lines=2, elem_id="text-in")
38
- image_in = gr.Image(label="图片输入", type="filepath", interactive=False, elem_id="image-in", height=300)
39
  with gr.Row():
40
- upload_image = gr.UploadButton("上传图片", file_types=["image"], file_count="single")
41
- image_submit = gr.Button("生成视频🎬")
42
  with gr.Column():
43
- video_out_1 = gr.Video(label='生成的视频', elem_id='video-out_1', interactive=False, height=300)
44
- gr.Markdown("<left><font size=2>注:如果生成的视频无法播放,请尝试升级浏览器或使用chrome浏览器。</left>")
 
 
 
45
 
46
 
47
  upload_image.upload(upload_file, upload_image, image_in, queue=False)
48
  image_submit.click(fn=image_to_video, inputs=[image_in, text_in], outputs=[video_out_1])
49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  demo.queue(status_update_rate=1, api_open=False).launch(share=False, show_error=True)
 
35
  with gr.Row():
36
  with gr.Column():
37
  text_in = gr.Textbox(label="文本描述", lines=2, elem_id="text-in")
38
+ image_in = gr.Image(label="Image Input/图片输入", type="filepath", interactive=False, elem_id="image-in", height=300)
39
  with gr.Row():
40
+ upload_image = gr.UploadButton("Upload Image/上传图片", file_types=["image"], file_count="single")
41
+ image_submit = gr.Button("Generate video/生成视频🎬")
42
  with gr.Column():
43
+ video_out_1 = gr.Video(label='Generated Video/生成的视频', elem_id='video-out_1', interactive=False, height=300)
44
+ gr.Markdown("""<left><font size=2>注:如果生成的视频无法播放,请尝试升级浏览器或使用chrome浏览器。</left>
45
+
46
+ <left><font size=2>Note: If the generated video cannot be played, please try to upgrade your browser or use the Chrome browser.</left>"""
47
+ )
48
 
49
 
50
  upload_image.upload(upload_file, upload_image, image_in, queue=False)
51
  image_submit.click(fn=image_to_video, inputs=[image_in, text_in], outputs=[video_out_1])
52
 
53
+ gr.Examples(examples=[
54
+ ['examples/sample10.png', 'A dog in a suit and tie faces the camera'],
55
+ ['examples/sample9.png', 'Chinese ink painting, two boats and two coconut trees by the sea'],
56
+ ['examples/sample8.png', 'A green frog floats on the surface of the water on green lotus leaves, with several pink lotus flowers, in a Chinese painting style.'],
57
+ ['examples/sample7.png', 'A red woodcut bird'],
58
+ ['examples/sample6.png', 'Papers were floating in the air on a table in the library'],
59
+ ['examples/sample5.png', 'a painting of a city street with a giant monster'],
60
+ ['examples/sample4.png', 'a girl standing in a field of wheat under a storm cloud'],
61
+ ['examples/sample2.png', 'A girl with yellow hair and black clothes stood in front of the camera'],
62
+ ['examples/sample1.png', 'A blonde girl in jeans'],
63
+ ],
64
+ inputs=[image_in, text_in],
65
+ outputs=[video_out_1],
66
+ fn=image_to_video,
67
+ cache_examples=True,
68
+ examples_per_page=5,
69
+ label='Examples',
70
+ elem_id='examples_elem'
71
+ )
72
+
73
  demo.queue(status_update_rate=1, api_open=False).launch(share=False, show_error=True)