Spaces:
Runtime error
Runtime error
lalashechka
commited on
Commit
•
f8c13b4
1
Parent(s):
81a1f6d
Update app.py
Browse files
app.py
CHANGED
@@ -15,6 +15,7 @@ import random
|
|
15 |
import tempfile
|
16 |
import re
|
17 |
from gradio_client import Client
|
|
|
18 |
|
19 |
|
20 |
def animate_img(encoded_string, model):
|
@@ -152,7 +153,16 @@ def create_video(prompt, model):
|
|
152 |
photo = r2.json()['data']['image_urls'][0]
|
153 |
break
|
154 |
c += 1
|
155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
|
157 |
|
158 |
def flip_text1(prompt, motion):
|
@@ -309,7 +319,7 @@ with gr.Blocks(css=css) as demo:
|
|
309 |
# prompt12 = gr.Textbox(placeholder="Введите описание видео...", show_label=True, label='Описание видео (опционально):', lines=3)
|
310 |
# motion2 = gr.Dropdown(value="Приближение →←", interactive=True, show_label=True, label="Движение камеры:", choices=["Приближение →←", "Отдаление ←→", "Вверх ↑", "Вниз ↓", "Влево ←", "Вправо →", "По часовой стрелке ⟳", "Против часовой стрелки ⟲"])
|
311 |
model2 = gr.Radio(interactive=True, value="Stable Video Diffusion", show_label=True,
|
312 |
-
label="Модель нейросети:", choices=['Stable Video Diffusion'
|
313 |
with gr.Column():
|
314 |
text_button2 = gr.Button("Анимировать изображение", variant='primary', elem_id="generate")
|
315 |
with gr.Column():
|
|
|
15 |
import tempfile
|
16 |
import re
|
17 |
from gradio_client import Client
|
18 |
+
import moviepy.editor as mp
|
19 |
|
20 |
|
21 |
def animate_img(encoded_string, model):
|
|
|
153 |
photo = r2.json()['data']['image_urls'][0]
|
154 |
break
|
155 |
c += 1
|
156 |
+
image = base64.b64encode(requests.get(photo).content).decode("utf-8")
|
157 |
+
|
158 |
+
with tempfile.NamedTemporaryFile(delete=False) as temp:
|
159 |
+
temp.write(base64.decodebytes(bytes(image, "utf-8")))
|
160 |
+
temp_file_path = temp.name
|
161 |
+
|
162 |
+
clip = mp.VideoFileClip(temp_file_path)
|
163 |
+
temp_file2 = tempfile.NamedTemporaryFile(delete=False)
|
164 |
+
clip.write_videofile(temp_file2.name)
|
165 |
+
return temp_file2.name
|
166 |
|
167 |
|
168 |
def flip_text1(prompt, motion):
|
|
|
319 |
# prompt12 = gr.Textbox(placeholder="Введите описание видео...", show_label=True, label='Описание видео (опционально):', lines=3)
|
320 |
# motion2 = gr.Dropdown(value="Приближение →←", interactive=True, show_label=True, label="Движение камеры:", choices=["Приближение →←", "Отдаление ←→", "Вверх ↑", "Вниз ↓", "Влево ←", "Вправо →", "По часовой стрелке ⟳", "Против часовой стрелки ⟲"])
|
321 |
model2 = gr.Radio(interactive=True, value="Stable Video Diffusion", show_label=True,
|
322 |
+
label="Модель нейросети:", choices=['Stable Video Diffusion'])
|
323 |
with gr.Column():
|
324 |
text_button2 = gr.Button("Анимировать изображение", variant='primary', elem_id="generate")
|
325 |
with gr.Column():
|