ai-forever commited on
Commit
8f5a4de
1 Parent(s): d362a2c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -16
app.py CHANGED
@@ -1,8 +1,8 @@
1
  # исправленная версия (чтобы не потерялась)
2
  import subprocess
3
- subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
4
  # subprocess.run('pip install bitsandbytes', shell=True)
5
- subprocess.run('pip install av==12.0.0', shell=True)
6
 
7
  import gradio as gr
8
  import spaces
@@ -69,11 +69,11 @@ def sample(
69
  base_count = len(glob(os.path.join(output_folder, "*.mp4")))
70
  video_path = os.path.join(output_folder, f"{base_count:06d}.mp4")
71
  res_variants = {
72
- '1:1': '512x512',
73
- '9:16': '384x672',
74
- '16:9': '672x384',
75
- '1:2': '352x736',
76
- '2:1': '736x352'
77
  }
78
  width = int(res_variants[resolution].split('x')[0])
79
  height = int(res_variants[resolution].split('x')[1])
@@ -125,14 +125,6 @@ def resize_image(image, output_size=(672, 384)):
125
  return cropped_image
126
 
127
  with gr.Blocks() as demo:
128
- aspect_ratio_variants = {
129
- '16:9 (672x384)': '16:9',
130
- '9:16 (384x672)': '9:16',
131
- '1:1 (512x512)': '1:1',
132
- '1:2 (352x736)': '1:2',
133
- '2:1 (736x352)': '2:1'
134
- }
135
-
136
  gr.Markdown('''# Community demo for Kandinsky 4.0 Flash''')
137
  with gr.Row():
138
  with gr.Column():
@@ -157,7 +149,6 @@ with gr.Blocks() as demo:
157
  choices=["16:9 (672x384)", "9:16 (384x672)", "1:1 (512x512)", "1:2 (352x736)", "2:1 (736x352)"],
158
  value="16:9 (672x384)"
159
  )
160
- aspect_ratio = aspect_ratio_variants[aspect_ratio]
161
  with gr.Column():
162
  enhance_button = gr.Button("Beautify prompt with [GigaChat-Max](https://giga.chat)")
163
  generate_btn = gr.Button("Generate Video")
 
1
  # исправленная версия (чтобы не потерялась)
2
  import subprocess
3
+ # subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
4
  # subprocess.run('pip install bitsandbytes', shell=True)
5
+ # subprocess.run('pip install av==12.0.0', shell=True)
6
 
7
  import gradio as gr
8
  import spaces
 
69
  base_count = len(glob(os.path.join(output_folder, "*.mp4")))
70
  video_path = os.path.join(output_folder, f"{base_count:06d}.mp4")
71
  res_variants = {
72
+ '16:9 (672x384)': '672x384',
73
+ '9:16 (384x672)': '384x672',
74
+ '1:1 (512x512)': '512x512',
75
+ '1:2 (352x736)': '352x736',
76
+ '2:1 (736x352)': '736x352'
77
  }
78
  width = int(res_variants[resolution].split('x')[0])
79
  height = int(res_variants[resolution].split('x')[1])
 
125
  return cropped_image
126
 
127
  with gr.Blocks() as demo:
 
 
 
 
 
 
 
 
128
  gr.Markdown('''# Community demo for Kandinsky 4.0 Flash''')
129
  with gr.Row():
130
  with gr.Column():
 
149
  choices=["16:9 (672x384)", "9:16 (384x672)", "1:1 (512x512)", "1:2 (352x736)", "2:1 (736x352)"],
150
  value="16:9 (672x384)"
151
  )
 
152
  with gr.Column():
153
  enhance_button = gr.Button("Beautify prompt with [GigaChat-Max](https://giga.chat)")
154
  generate_btn = gr.Button("Generate Video")