sejamenath2023 commited on
Commit
c86f2ac
โ€ข
1 Parent(s): 82679a0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -8,14 +8,14 @@ image_to_video_pipe = pipeline(task="image-to-video", model='damo/i2vgen-xl', mo
8
 
9
  # Get the current working directory
10
  current_directory = os.path.dirname(os.path.realpath(__file__))
11
- print("Current Working Directory:", current_directory)
12
 
13
  def upload_file(file):
14
  return file.name
15
 
16
  def image_to_video(image_in, text_in):
17
  if image_in is None:
18
- raise gr.Error('Please upload the image or wait for the image upload to complete / ่ฏทไธŠไผ ๅ›พ็‰‡ๆˆ–็ญ‰ๅพ…ๅ›พ็‰‡ไธŠไผ ๅฎŒๆˆ')
19
  print(image_in)
20
  output_video_path = image_to_video_pipe(image_in, caption=text_in)[OutputKeys.OUTPUT_VIDEO]
21
  print(output_video_path)
@@ -24,28 +24,28 @@ def image_to_video(image_in, text_in):
24
 
25
  with gr.Blocks() as demo:
26
  gr.Markdown(
27
- """<center><font size=7>I2VGen-XL</center>
28
- <left><font size=3>I2VGen-XLๅฏไปฅๆ นๆฎ็”จๆˆท่พ“ๅ…ฅ็š„้™ๆ€ๅ›พๅƒๅ’Œๆ–‡ๆœฌ็”Ÿๆˆ็›ฎๆ ‡ๆŽฅ่ฟ‘ใ€่ฏญไน‰็›ธๅŒ็š„่ง†้ข‘๏ผŒ็”Ÿๆˆ็š„่ง†้ข‘ๅ…ท้ซ˜ๆธ…(1280 * 720)ใ€ๅฎฝๅฑ(16:9)ใ€ๆ—ถๅบ่ฟž่ดฏใ€่ดจๆ„Ÿๅฅฝ็ญ‰็‰น็‚นใ€‚</left>
29
 
30
- <left><font size=3>I2VGen-XL can generate videos with similar contents and semantics based on user input static images and text. The generated videos have characteristics such as high-definition (1280 * 720), widescreen (16:9), coherent timing, and good texture.</left>
31
  """
32
  )
33
  with gr.Box():
34
  gr.Markdown(
35
- """<left><font size=3>้€‰ๆ‹ฉๅˆ้€‚็š„ๅ›พ็‰‡่ฟ›่กŒไธŠไผ ๏ผŒๅนถ่กฅๅ……ๅฏน่ง†้ข‘ๅ†…ๅฎน็š„่‹ฑๆ–‡ๆ–‡ๆœฌๆ่ฟฐ๏ผŒ็„ถๅŽ็‚นๅ‡ปโ€œ็”Ÿๆˆ่ง†้ข‘โ€ใ€‚</left>
36
 
37
  <left><font size=3>Please choose the image to upload (we recommend the image size be 1280 * 720), provide the English text description of the video you wish to create, and then click on "Generate Video" to receive the generated video.</left>"""
38
  )
39
  with gr.Row():
40
  with gr.Column():
41
- text_in = gr.Textbox(label="Text description/ๆ–‡ๆœฌๆ่ฟฐ", lines=2, elem_id="text-in")
42
- image_in = gr.Image(label="Image Input/ๅ›พ็‰‡่พ“ๅ…ฅ", type="filepath", interactive=False, elem_id="image-in", height=300)
43
  with gr.Row():
44
- upload_image = gr.UploadButton("Upload Image/ไธŠไผ ๅ›พ็‰‡", file_types=["image"], file_count="single")
45
- image_submit = gr.Button("Generate video/็”Ÿๆˆ่ง†้ข‘๐ŸŽฌ")
46
  with gr.Column():
47
- video_out_1 = gr.Video(label='Generated Video/็”Ÿ็”Ÿๆˆ็š„่ง†้ข‘', elem_id='video-out_1', interactive=False, height=300)
48
- gr.Markdown("""<left><font size=2>ๆณจ๏ผšๅฆ‚ๆžœ็”Ÿๆˆ็š„่ง†้ข‘ๆ— ๆณ•ๆ’ญๆ”พ๏ผŒ่ฏทๅฐ่ฏ•ๅ‡็บงๆต่งˆๅ™จๆˆ–ไฝฟ็”จchromeๆต่งˆๅ™จใ€‚</left>
49
 
50
  <left><font size=2>Note: If the generated video cannot be played, please try to upgrade your browser or use the Chrome browser.</left>"""
51
  )
 
8
 
9
  # Get the current working directory
10
  current_directory = os.path.dirname(os.path.realpath(__file__))
11
+ print("", current_directory)
12
 
13
  def upload_file(file):
14
  return file.name
15
 
16
  def image_to_video(image_in, text_in):
17
  if image_in is None:
18
+ raise gr.Error('Please upload the image or wait for the image upload to complete')
19
  print(image_in)
20
  output_video_path = image_to_video_pipe(image_in, caption=text_in)[OutputKeys.OUTPUT_VIDEO]
21
  print(output_video_path)
 
24
 
25
  with gr.Blocks() as demo:
26
  gr.Markdown(
27
+ """<center><font size=7>COLIPIC.AI-XLv2</center>
28
+ <left><font size=3>SRI LANKA</left>
29
 
30
+ <left><font size=3>COLIPIC.AI-XLv2 can generate videos with similar contents and semantics based on user input static images and text. The generated videos have characteristics such as high-definition (1280 * 720), widescreen (16:9), coherent timing, and good texture.</left>
31
  """
32
  )
33
  with gr.Box():
34
  gr.Markdown(
35
+ """<left><font size=3></left>
36
 
37
  <left><font size=3>Please choose the image to upload (we recommend the image size be 1280 * 720), provide the English text description of the video you wish to create, and then click on "Generate Video" to receive the generated video.</left>"""
38
  )
39
  with gr.Row():
40
  with gr.Column():
41
+ text_in = gr.Textbox(label="Text description", lines=2, elem_id="text-in")
42
+ image_in = gr.Image(label="Image Input", type="filepath", interactive=False, elem_id="image-in", height=300)
43
  with gr.Row():
44
+ upload_image = gr.UploadButton("Upload Image", file_types=["image"], file_count="single")
45
+ image_submit = gr.Button("Generate video")
46
  with gr.Column():
47
+ video_out_1 = gr.Video(label='Generated Video', elem_id='video-out_1', interactive=False, height=300)
48
+ gr.Markdown("""<left><font size=2></left>
49
 
50
  <left><font size=2>Note: If the generated video cannot be played, please try to upgrade your browser or use the Chrome browser.</left>"""
51
  )