Ruslan Magana Vsevolodovna
commited on
Commit
·
b0a317b
1
Parent(s):
180d1e9
Update app.py
Browse files
app.py
CHANGED
@@ -2,18 +2,9 @@
|
|
2 |
from moviepy.editor import *
|
3 |
from PIL import Image
|
4 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM,pipeline
|
5 |
-
import requests
|
6 |
import gradio as gr
|
7 |
import torch
|
8 |
-
import re
|
9 |
-
import os
|
10 |
-
import sys
|
11 |
from huggingface_hub import snapshot_download
|
12 |
-
import base64
|
13 |
-
import io
|
14 |
-
import cv2
|
15 |
-
import argparse
|
16 |
-
import os
|
17 |
from PIL import Image
|
18 |
from min_dalle import MinDalle
|
19 |
import torch
|
@@ -22,14 +13,10 @@ import textwrap
|
|
22 |
from mutagen.mp3 import MP3
|
23 |
# to speech conversion
|
24 |
from gtts import gTTS
|
25 |
-
from IPython.display import Audio
|
26 |
-
from IPython.display import display
|
27 |
from pydub import AudioSegment
|
28 |
from os import getcwd
|
29 |
import glob
|
30 |
import nltk
|
31 |
-
from IPython.display import HTML
|
32 |
-
from base64 import b64encode
|
33 |
nltk.download('punkt')
|
34 |
|
35 |
description = " Video Story Generator with Audio \n PS: Generation of video by using Artifical Intellingence by dalle-mini and distilbart and gtss "
|
@@ -62,7 +49,8 @@ def get_output_video(text):
|
|
62 |
models_root=models_root,
|
63 |
is_reusable=False,
|
64 |
is_verbose=True,
|
65 |
-
dtype=torch.float16 if fp16 else torch.float32
|
|
|
66 |
)
|
67 |
|
68 |
image = model.generate_image(
|
@@ -77,7 +65,6 @@ def get_output_video(text):
|
|
77 |
|
78 |
generated_images = []
|
79 |
for senten in plot[:-1]:
|
80 |
-
#print(senten)
|
81 |
image=generate_image(
|
82 |
is_mega='store_true',
|
83 |
text=senten,
|
@@ -212,7 +199,7 @@ def get_output_video(text):
|
|
212 |
audio_background = mpe.AudioFileClip(audname)
|
213 |
final_clip = my_clip.set_audio(audio_background)
|
214 |
final_clip.write_videofile(outname,fps=fps)
|
215 |
-
combine_audio(movie_name, export_path, movie_final) #
|
216 |
return 'result_final.mp4'
|
217 |
text ='Once, there was a girl called Laura who went to the supermarket to buy the ingredients to make a cake. Because today is her birthday and her friends come to her house and help her to prepare the cake.'
|
218 |
demo = gr.Blocks()
|
|
|
2 |
from moviepy.editor import *
|
3 |
from PIL import Image
|
4 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM,pipeline
|
|
|
5 |
import gradio as gr
|
6 |
import torch
|
|
|
|
|
|
|
7 |
from huggingface_hub import snapshot_download
|
|
|
|
|
|
|
|
|
|
|
8 |
from PIL import Image
|
9 |
from min_dalle import MinDalle
|
10 |
import torch
|
|
|
13 |
from mutagen.mp3 import MP3
|
14 |
# to speech conversion
|
15 |
from gtts import gTTS
|
|
|
|
|
16 |
from pydub import AudioSegment
|
17 |
from os import getcwd
|
18 |
import glob
|
19 |
import nltk
|
|
|
|
|
20 |
nltk.download('punkt')
|
21 |
|
22 |
description = " Video Story Generator with Audio \n PS: Generation of video by using Artifical Intellingence by dalle-mini and distilbart and gtss "
|
|
|
49 |
models_root=models_root,
|
50 |
is_reusable=False,
|
51 |
is_verbose=True,
|
52 |
+
#dtype=torch.float16 if fp16 else torch.float32
|
53 |
+
dtype=torch.float32
|
54 |
)
|
55 |
|
56 |
image = model.generate_image(
|
|
|
65 |
|
66 |
generated_images = []
|
67 |
for senten in plot[:-1]:
|
|
|
68 |
image=generate_image(
|
69 |
is_mega='store_true',
|
70 |
text=senten,
|
|
|
199 |
audio_background = mpe.AudioFileClip(audname)
|
200 |
final_clip = my_clip.set_audio(audio_background)
|
201 |
final_clip.write_videofile(outname,fps=fps)
|
202 |
+
combine_audio(movie_name, export_path, movie_final) # create a new file
|
203 |
return 'result_final.mp4'
|
204 |
text ='Once, there was a girl called Laura who went to the supermarket to buy the ingredients to make a cake. Because today is her birthday and her friends come to her house and help her to prepare the cake.'
|
205 |
demo = gr.Blocks()
|