Update app.py
Browse files
app.py
CHANGED
|
@@ -99,6 +99,7 @@ def split_text(text, max_length=800):
|
|
| 99 |
split_at = max_length
|
| 100 |
chunks.append(text[:split_at])
|
| 101 |
text = text[split_at:].lstrip()
|
|
|
|
| 102 |
logger.debug(f"Split text into {len(chunks)} chunks")
|
| 103 |
return chunks
|
| 104 |
|
|
@@ -318,16 +319,15 @@ if st.button("Создать видео"):
|
|
| 318 |
with st.spinner("Генерация видео..."):
|
| 319 |
video_filename = process_prompt(prompt)
|
| 320 |
if video_filename:
|
| 321 |
-
# Read video into memory
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
os.remove(video_filename)
|
| 331 |
else:
|
| 332 |
st.error("Не удалось создать видео.")
|
| 333 |
else:
|
|
|
|
| 99 |
split_at = max_length
|
| 100 |
chunks.append(text[:split_at])
|
| 101 |
text = text[split_at:].lstrip()
|
| 102 |
+
chunks.append(text)
|
| 103 |
logger.debug(f"Split text into {len(chunks)} chunks")
|
| 104 |
return chunks
|
| 105 |
|
|
|
|
| 319 |
with st.spinner("Генерация видео..."):
|
| 320 |
video_filename = process_prompt(prompt)
|
| 321 |
if video_filename:
|
| 322 |
+
# Read the video file into memory as raw bytes
|
| 323 |
+
with open(video_filename, "rb") as video_file:
|
| 324 |
+
video_data = video_file.read()
|
| 325 |
+
|
| 326 |
+
# Display the video using raw data
|
| 327 |
+
st.video(video_data, format="video/mp4")
|
| 328 |
+
|
| 329 |
+
# Clean up the temporary video file
|
| 330 |
+
os.remove(video_filename)
|
|
|
|
| 331 |
else:
|
| 332 |
st.error("Не удалось создать видео.")
|
| 333 |
else:
|