Spaces:
Runtime error
Runtime error
macrdel
commited on
Commit
·
f5172c9
1
Parent(s):
c5c8388
update src.py
Browse files- app/src/src.py +3 -1
app/src/src.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import pandas as pd
|
2 |
import requests
|
|
|
3 |
import urllib.parse as urlparse
|
4 |
|
5 |
|
@@ -45,6 +46,7 @@ def get_comments(api_key, video_id):
|
|
45 |
def get_sentim(data, headers, url):
|
46 |
"""Get result of sentimental analysis"""
|
47 |
res = requests.post(url, headers=headers, json=data)
|
|
|
48 |
res = res.json()[0][0]
|
49 |
return res['label'], res['score']
|
50 |
|
@@ -78,4 +80,4 @@ def pipeline_summarize(data, headers, url, length=2000, max_length=35):
|
|
78 |
res = requests.post(url, headers=headers, json=payload)
|
79 |
result_text.append(res.json()[0]["generated_text"])
|
80 |
|
81 |
-
return "
|
|
|
1 |
import pandas as pd
|
2 |
import requests
|
3 |
+
import time
|
4 |
import urllib.parse as urlparse
|
5 |
|
6 |
|
|
|
46 |
def get_sentim(data, headers, url):
|
47 |
"""Get result of sentimental analysis"""
|
48 |
res = requests.post(url, headers=headers, json=data)
|
49 |
+
time.sleep(0.25)
|
50 |
res = res.json()[0][0]
|
51 |
return res['label'], res['score']
|
52 |
|
|
|
80 |
res = requests.post(url, headers=headers, json=payload)
|
81 |
result_text.append(res.json()[0]["generated_text"])
|
82 |
|
83 |
+
return " ".join(result_text)
|