youngshen commited on
Commit
b68b40e
·
verified ·
1 Parent(s): 9d22775

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -19,10 +19,13 @@ speaker_embeddings = {
19
  "SLT": "spkemb/cmu_us_slt_arctic-wav-arctic_a0508.npy",
20
  }
21
 
22
- def getNews():
23
- return requests.get ("https://newsapi.org/v2/everything?q=" +text+ "&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
 
27
  def predict(text, speaker):
28
  if len(text.strip()) == 0:
@@ -30,7 +33,7 @@ def predict(text, speaker):
30
 
31
  # text = getNews ()
32
  # inputs = processor(text=text, return_tensors="pt")
33
- inputs = processor(text=getNews(),
34
  return_tensors="pt")
35
 
36
  # limit input length
 
19
  "SLT": "spkemb/cmu_us_slt_arctic-wav-arctic_a0508.npy",
20
  }
21
 
22
+ def getNews(search_key):
23
+ return requests.get ("https://newsapi.org/v2/everything?q=" +search_key+ "&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")
28
+
29
 
30
  def predict(text, speaker):
31
  if len(text.strip()) == 0:
 
33
 
34
  # text = getNews ()
35
  # inputs = processor(text=text, return_tensors="pt")
36
+ inputs = processor(text=getNews(text),
37
  return_tensors="pt")
38
 
39
  # limit input length