Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -13,6 +13,7 @@ Original file is located at
|
|
13 |
import PyPDF2
|
14 |
import re
|
15 |
import transformers
|
|
|
16 |
from transformers import pipeline
|
17 |
from bark import SAMPLE_RATE, generate_audio, preload_models
|
18 |
from scipy.io.wavfile import write as write_wav
|
@@ -67,12 +68,16 @@ def abstract_to_audio(insert_pdf):
|
|
67 |
|
68 |
# Generate audio file that speaks the generated sentence using Bark
|
69 |
# download and load all models
|
70 |
-
preload_models()
|
71 |
|
72 |
# generate audio from text
|
73 |
-
text_prompt = tss_prompt
|
74 |
-
audio_array = generate_audio(text_prompt)
|
75 |
-
return (15500, audio_array)
|
|
|
|
|
|
|
|
|
76 |
|
77 |
|
78 |
|
|
|
13 |
import PyPDF2
|
14 |
import re
|
15 |
import transformers
|
16 |
+
import scipy
|
17 |
from transformers import pipeline
|
18 |
from bark import SAMPLE_RATE, generate_audio, preload_models
|
19 |
from scipy.io.wavfile import write as write_wav
|
|
|
68 |
|
69 |
# Generate audio file that speaks the generated sentence using Bark
|
70 |
# download and load all models
|
71 |
+
#preload_models()
|
72 |
|
73 |
# generate audio from text
|
74 |
+
#text_prompt = tss_prompt
|
75 |
+
#audio_array = generate_audio(text_prompt)
|
76 |
+
#return (15500, audio_array)
|
77 |
+
|
78 |
+
tss_pipeline = pipeline("text-to-speech", "suno/bark")
|
79 |
+
speech = tss_pipeline(tss_prompt, forward_params={"do_sample": True})
|
80 |
+
return (rate=speech["sampling_rate"], data=speech["audio"])
|
81 |
|
82 |
|
83 |
|