radames commited on
Commit
c237b6b
1 Parent(s): d68759e

cache examples here

Browse files
.gitignore CHANGED
@@ -3,5 +3,4 @@ env
3
  venv/
4
  __pycache__/
5
  .DS_Store
6
- flagged
7
- gradio_cached_examples/
 
3
  venv/
4
  __pycache__/
5
  .DS_Store
6
+ flagged
 
app.py CHANGED
@@ -64,11 +64,13 @@ def get_completion(prompt, files_info, top_p, temperature):
64
 
65
  files_info_string = ""
66
  for file_info in files_info:
67
- files_info_string += f"""{file_info["type"]} name {file_info["name"]}"""
68
  if file_info["type"] == "video" or file_info["type"] == "image":
69
  files_info_string += f""" {file_info["dimensions"]}"""
70
- if file_info["type"] == "video" or file_info["type"] == "audio" or file_info["type"] == "video/audio":
71
- files_info_string += f""" {file_info["duration"]}s with {file_info["audio_channels"]} audio channels"""
 
 
72
  files_info_string += "\n"
73
 
74
  messages = [
@@ -227,7 +229,7 @@ with gr.Blocks(css=css) as demo:
227
  "./examples/cat6.jpeg",
228
  "./examples/cat7.jpeg",
229
  "./examples/heat-wave.mp3"],
230
- "make a video gif each image 1s loop and audio as background",
231
  0, 0
232
  ],
233
  [
@@ -250,7 +252,7 @@ with gr.Blocks(css=css) as demo:
250
  inputs=[user_files, user_prompt, top_p, temperature],
251
  outputs=[generated_video, generated_command],
252
  fn=update,
253
- cache_examples=False,
254
  )
255
 
256
  with gr.Row():
 
64
 
65
  files_info_string = ""
66
  for file_info in files_info:
67
+ files_info_string += f"""{file_info["type"]} {file_info["name"]}"""
68
  if file_info["type"] == "video" or file_info["type"] == "image":
69
  files_info_string += f""" {file_info["dimensions"]}"""
70
+ if file_info["type"] == "video" or file_info["type"] == "audio":
71
+ files_info_string += f""" {file_info["duration"]}s"""
72
+ if file_info["type"] == "audio" or file_info["type"] == "video/audio":
73
+ files_info_string += f""" {file_info["audio_channels"]} audio channels"""
74
  files_info_string += "\n"
75
 
76
  messages = [
 
229
  "./examples/cat6.jpeg",
230
  "./examples/cat7.jpeg",
231
  "./examples/heat-wave.mp3"],
232
+ "make a video gif, each image with 1s loop and add the audio as background",
233
  0, 0
234
  ],
235
  [
 
252
  inputs=[user_files, user_prompt, top_p, temperature],
253
  outputs=[generated_video, generated_command],
254
  fn=update,
255
+ cache_examples=True,
256
  )
257
 
258
  with gr.Row():
gradio_cached_examples/16/Generated Video/output_1fc1a2bc-adf6-49e5-9d21-f18c3b41ba43g_zn_sb1.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c7fcce626d63ccb2d54785c5c9f5c7a9a358edaeadb7a26d29c3ea1abefd3c9f
3
+ size 1096372
gradio_cached_examples/16/Generated Video/output_6fc596c0-a6c1-4d82-835b-e71235e1e6b4fc5i96ga.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c1a7e58c9fd01521fe5d53016b9299f44e08b55a10a0e07cef994b6433cdb0ec
3
+ size 710383
gradio_cached_examples/16/Generated Video/output_7bb3ec9e-4852-46dc-bf6c-f0b5164a92c6luig6jbo.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:709b9da1af05e55569ec70eb397d1554db33f8f63f5a64955ae86a79ccf46348
3
+ size 6654298
gradio_cached_examples/16/Generated Video/output_c92451ec-30d4-4ddf-972e-df49d0e3db180wg_ji3_.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9287a470a1404db7c01641d4794545670b1f9bfb6d9cc19e2c48883402cdf74f
3
+ size 68714
gradio_cached_examples/16/log.csv ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Generated Video,component 1,flag,username,timestamp
2
+ /Users/radames/Development/hf-spaces/video-composer/gradio_cached_examples/16/Generated Video/output_6fc596c0-a6c1-4d82-835b-e71235e1e6b4fc5i96ga.mp4,"{'value': '<h3>Generated Command</h3>\n<pre><code class=""language-bash""> ffmpeg\n -loop 1\n -i cat1.jpeg\n -loop 1\n -i cat2.jpeg\n -loop 1\n -i cat3.jpeg\n -loop 1\n -i cat4.jpeg\n -loop 1\n -i cat5.jpeg\n -loop 1\n -i cat6.jpeg\n -loop 1\n -i cat7.jpeg\n -loop 1\n -i cat8.jpeg\n -i heat-wave.mp3\n -filter_complex [0:v]trim=duration=1[v0];[1:v]trim=duration=1[v1];[2:v]trim=duration=1[v2];[3:v]trim=duration=1[v3];[4:v]trim=duration=1[v4];[5:v]trim=duration=1[v5];[6:v]trim=duration=1[v6];[7:v]trim=duration=1[v7];[v0][v1][v2][v3][v4][v5][v6][v7]concat=n=8:v=1:a=0[v]\n -map [v]\n -map 8:a\n -shortest\n -y\n -y output.mp4\n</code></pre>\n', '__type__': 'update'}",,,2023-03-23 11:30:22.380665
3
+ /Users/radames/Development/hf-spaces/video-composer/gradio_cached_examples/16/Generated Video/output_c92451ec-30d4-4ddf-972e-df49d0e3db180wg_ji3_.mp4,"{'value': '<h3>Generated Command</h3>\n<pre><code class=""language-bash""> ffmpeg\n -i example.mp4\n -vf setpts=0.1*PTS\n -an\n -y output.mp4\n</code></pre>\n', '__type__': 'update'}",,,2023-03-23 11:30:26.591636
4
+ /Users/radames/Development/hf-spaces/video-composer/gradio_cached_examples/16/Generated Video/output_7bb3ec9e-4852-46dc-bf6c-f0b5164a92c6luig6jbo.mp4,"{'value': '<h3>Generated Command</h3>\n<pre><code class=""language-bash""> ffmpeg\n -i heat-wave.mp3\n -loop 1\n -i square-image.png\n -filter_complex [0:a]showwaves=s=720x720:mode=line:colors=white[waves];[1:v]scale=720:720[bg];[bg][waves]overlay=0:0\n -t 40.42\n -c:v libx264\n -pix_fmt yuv420p\n -y output.mp4\n</code></pre>\n', '__type__': 'update'}",,,2023-03-23 11:30:52.054685
5
+ /Users/radames/Development/hf-spaces/video-composer/gradio_cached_examples/16/Generated Video/output_1fc1a2bc-adf6-49e5-9d21-f18c3b41ba43g_zn_sb1.mp4,"{'value': '<h3>Generated Command</h3>\n<pre><code class=""language-bash""> ffmpeg\n -i waterfall.mp4\n -i waterfall-overlay.png\n -filter_complex [0:v][1:v]overlay=0:0\n -c:a copy\n -y output.mp4\n</code></pre>\n', '__type__': 'update'}",,,2023-03-23 11:30:58.716886