Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -21,7 +21,6 @@ speaker_embeddings = {
|
|
21 |
|
22 |
def getNews(search_key):
|
23 |
return requests.get ("https://newsapi.org/v2/everything?q=" +search_key+ "&pagesize=3&apiKey=3bca07c913ec4703a23f6ba03e15b30b").content.decode("utf-8")
|
24 |
-
# return requests.get ("https://newsapi.org/v2/top-headlines?country=us&apiKey=3bca07c913ec4703a23f6ba03e15b30b").content.decode("utf-8" )
|
25 |
|
26 |
def getHeadlines():
|
27 |
return requests.get ("https://newsapi.org/v2/top-headlines?country=us&apiKey=3bca07c913ec4703a23f6ba03e15b30b").content.decode("utf-8")
|
@@ -33,16 +32,14 @@ def predict(text, speaker, preset):
|
|
33 |
|
34 |
# text = getNews ()
|
35 |
# inputs = processor(text=text, return_tensors="pt")
|
36 |
-
inputs = processor(text=getNews(
|
37 |
-
return_tensors="pt")
|
38 |
|
39 |
# limit input length
|
40 |
input_ids = inputs["input_ids"]
|
41 |
input_ids = input_ids[..., :model.config.max_text_positions]
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
speaker_embedding = torch.tensor(speaker_embedding).unsqueeze(0)
|
47 |
|
48 |
speech = model.generate_speech(input_ids, speaker_embedding, vocoder=vocoder)
|
|
|
21 |
|
22 |
def getNews(search_key):
|
23 |
return requests.get ("https://newsapi.org/v2/everything?q=" +search_key+ "&pagesize=3&apiKey=3bca07c913ec4703a23f6ba03e15b30b").content.decode("utf-8")
|
|
|
24 |
|
25 |
def getHeadlines():
|
26 |
return requests.get ("https://newsapi.org/v2/top-headlines?country=us&apiKey=3bca07c913ec4703a23f6ba03e15b30b").content.decode("utf-8")
|
|
|
32 |
|
33 |
# text = getNews ()
|
34 |
# inputs = processor(text=text, return_tensors="pt")
|
35 |
+
inputs = processor(text=getNews(preset), return_tensors="pt")
|
|
|
36 |
|
37 |
# limit input length
|
38 |
input_ids = inputs["input_ids"]
|
39 |
input_ids = input_ids[..., :model.config.max_text_positions]
|
40 |
|
41 |
+
speaker_embedding = np.load("spkemb/cmu_us_bdl_arctic-wav-arctic_a0009.npy")
|
42 |
+
|
|
|
43 |
speaker_embedding = torch.tensor(speaker_embedding).unsqueeze(0)
|
44 |
|
45 |
speech = model.generate_speech(input_ids, speaker_embedding, vocoder=vocoder)
|