Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -38,11 +38,17 @@ def merge_audio_video(entities_num, resize_img_list, text_input):
|
|
38 |
|
39 |
return mergedclip
|
40 |
|
41 |
-
fastspeech = gr.Interface.load("huggingface/facebook/fastspeech2-en-ljspeech", api_key=HF_TOKEN)
|
42 |
-
|
43 |
def text2speech(text):
|
44 |
-
speech
|
45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
|
47 |
def engine(text_input):
|
48 |
ner = gr.Interface.load("huggingface/flair/ner-english-ontonotes-large", api_key=HF_TOKEN)
|
@@ -63,6 +69,11 @@ def engine(text_input):
|
|
63 |
|
64 |
return 'mergedvideo.mp4'
|
65 |
|
|
|
|
|
|
|
|
|
|
|
66 |
app = gr.Interface(
|
67 |
fn=engine,
|
68 |
inputs=gr.Textbox(lines=5, label="Input Text"),
|
|
|
38 |
|
39 |
return mergedclip
|
40 |
|
|
|
|
|
41 |
def text2speech(text):
|
42 |
+
# Generate speech from text using FastSpeech2
|
43 |
+
speech_output = fastspeech(text)
|
44 |
+
# Save the output as a .flac file (assuming the output is in numpy format)
|
45 |
+
with open("speech_output.flac", "wb") as f:
|
46 |
+
f.write(speech_output["audio"])
|
47 |
+
return "speech_output.flac"
|
48 |
+
|
49 |
+
# Load FastSpeech2 model from Hugging Face directly
|
50 |
+
fastspeech = pipeline("text-to-speech", model="facebook/fastspeech2-en-ljspeech", use_auth_token=HF_TOKEN)
|
51 |
+
|
52 |
|
53 |
def engine(text_input):
|
54 |
ner = gr.Interface.load("huggingface/flair/ner-english-ontonotes-large", api_key=HF_TOKEN)
|
|
|
69 |
|
70 |
return 'mergedvideo.mp4'
|
71 |
|
72 |
+
|
73 |
+
|
74 |
+
|
75 |
+
|
76 |
+
|
77 |
app = gr.Interface(
|
78 |
fn=engine,
|
79 |
inputs=gr.Textbox(lines=5, label="Input Text"),
|