awacke1 commited on
Commit
a1c58e6
ยท
1 Parent(s): 2d7188a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -8,6 +8,9 @@ import mutagen
8
  from mutagen.mp3 import MP3
9
  import cv2
10
 
 
 
 
11
  def resize(img_list):
12
  resize_img_list = []
13
  for item in img_list:
@@ -33,20 +36,20 @@ def merge_audio_video(entities_num, resize_img_list, text_input):
33
  frame_count = mergedclip.fps
34
  return mergedclip
35
 
36
- fastspeech = gr.Interface.load("huggingface/facebook/fastspeech2-en-ljspeech")
37
 
38
  def text2speech(text):
39
  speech = fastspeech(text)
40
  return speech
41
 
42
  def engine(text_input):
43
- ner = gr.Interface.load("huggingface/flair/ner-english-ontonotes-large")
44
  entities = ner(text_input)
45
  entities = [tupl for tupl in entities if None not in tupl]
46
  entities_num = len(entities)
47
  img_list = []
48
  for ent in entities:
49
- img = gr.Interface.load("spaces/multimodalart/latentdiffusion")(ent[0],'50','256','256','1',10)[0]
50
  img_list.append(img)
51
  resize_img_list = resize(img_list)
52
  mergedclip = merge_audio_video(entities_num, resize_img_list, text_input)
 
8
  from mutagen.mp3 import MP3
9
  import cv2
10
 
11
+ HF_TOKEN = os.environ.get("HF_TOKEN")
12
+
13
+
14
  def resize(img_list):
15
  resize_img_list = []
16
  for item in img_list:
 
36
  frame_count = mergedclip.fps
37
  return mergedclip
38
 
39
+ fastspeech = gr.Interface.load("huggingface/facebook/fastspeech2-en-ljspeech", api_key=HF_TOKEN)
40
 
41
  def text2speech(text):
42
  speech = fastspeech(text)
43
  return speech
44
 
45
  def engine(text_input):
46
+ ner = gr.Interface.load("huggingface/flair/ner-english-ontonotes-large", api_key=HF_TOKEN)
47
  entities = ner(text_input)
48
  entities = [tupl for tupl in entities if None not in tupl]
49
  entities_num = len(entities)
50
  img_list = []
51
  for ent in entities:
52
+ img = gr.Interface.load("spaces/multimodalart/latentdiffusion, api_key=HF_TOKEN")(ent[0],'50','256','256','1',10)[0]
53
  img_list.append(img)
54
  resize_img_list = resize(img_list)
55
  mergedclip = merge_audio_video(entities_num, resize_img_list, text_input)