yufengzhu commited on
Commit
17f0cb5
·
1 Parent(s): a355a0e

debugging by zyf

Browse files
Files changed (1) hide show
  1. app.py +12 -14
app.py CHANGED
@@ -44,18 +44,17 @@ def post(
44
  'image_prompt': image_prompt
45
  })
46
  r = requests.post(url, data, headers=headers)
47
- print(r.json())
48
  translated_text = r.json()['data']['translated_text']
49
  result_video = r.json()['data']['result_video']
50
  frames = r.json()['data']['frames']
51
- print(len(frames))
52
- print('-----------------')
53
- writer = iio.get_writer(result_video, fps=4)
54
- for frame in frames:
55
- writer.append_data(np.array(frame))
56
- writer.close()
57
  print('finish')
58
- return translated_text, result_video, result_video, result_video, result_video
59
 
60
  def main():
61
  only_first_stage = True
@@ -91,13 +90,13 @@ def main():
91
  translated_text = gr.Textbox(label='Translated Text')
92
  with gr.Tabs():
93
  with gr.TabItem('Output1 (Video)'):
94
- result_video1 = gr.Video(show_label=False)
95
  with gr.TabItem('Output2 (Video)'):
96
- result_video2 = gr.Video(show_label=False)
97
  with gr.TabItem('Output3 (Video)'):
98
- result_video3 = gr.Video(show_label=False)
99
  with gr.TabItem('Output4 (Video)'):
100
- result_video4 = gr.Video(show_label=False)
101
 
102
  # examples = gr.Examples(
103
  # examples=[['骑滑板的皮卡丘', False, 1234, True,None],
@@ -118,8 +117,7 @@ def main():
118
  only_first_stage,
119
  image_prompt
120
  ],
121
- outputs=[translated_text, result_video1, result_video2,
122
- result_video3, result_video4])
123
  print(gr.__version__)
124
 
125
  demo.launch()
 
44
  'image_prompt': image_prompt
45
  })
46
  r = requests.post(url, data, headers=headers)
47
+
48
  translated_text = r.json()['data']['translated_text']
49
  result_video = r.json()['data']['result_video']
50
  frames = r.json()['data']['frames']
51
+ for i in range(4):
52
+ writer = iio.get_writer(result_video[i], fps=4)
53
+ for frame in frames[i]:
54
+ writer.append_data(np.array(frame))
55
+ writer.close()
 
56
  print('finish')
57
+ return translated_text, result_video
58
 
59
  def main():
60
  only_first_stage = True
 
90
  translated_text = gr.Textbox(label='Translated Text')
91
  with gr.Tabs():
92
  with gr.TabItem('Output1 (Video)'):
93
+ result_video[0] = gr.Video(show_label=False)
94
  with gr.TabItem('Output2 (Video)'):
95
+ result_video[1] = gr.Video(show_label=False)
96
  with gr.TabItem('Output3 (Video)'):
97
+ result_video[2] = gr.Video(show_label=False)
98
  with gr.TabItem('Output4 (Video)'):
99
+ result_video[3] = gr.Video(show_label=False)
100
 
101
  # examples = gr.Examples(
102
  # examples=[['骑滑板的皮卡丘', False, 1234, True,None],
 
117
  only_first_stage,
118
  image_prompt
119
  ],
120
+ outputs=[translated_text, result_video])
 
121
  print(gr.__version__)
122
 
123
  demo.launch()