Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1179,6 +1179,8 @@ def summarize_with_huggingface(api_key, file_path):
|
|
1179 |
"parameters": {"max_length": 4096, "min_length": 100}
|
1180 |
}
|
1181 |
|
|
|
|
|
1182 |
for attempt in range(max_retries):
|
1183 |
response = requests.post(API_URL, headers=headers, json=data)
|
1184 |
if response.status_code == 200:
|
@@ -1193,7 +1195,7 @@ def summarize_with_huggingface(api_key, file_path):
|
|
1193 |
|
1194 |
if api_key == "":
|
1195 |
api_key = os.environ.get("HF_TOKEN")
|
1196 |
-
|
1197 |
try:
|
1198 |
logging.debug("huggingface: Loading json data for summarization")
|
1199 |
with open(file_path, 'r') as file:
|
@@ -1203,7 +1205,7 @@ def summarize_with_huggingface(api_key, file_path):
|
|
1203 |
text = ' '.join([segment['text'] for segment in segments])
|
1204 |
|
1205 |
api_key = os.environ.get('HF_TOKEN')
|
1206 |
-
|
1207 |
|
1208 |
|
1209 |
|
|
|
1179 |
"parameters": {"max_length": 4096, "min_length": 100}
|
1180 |
}
|
1181 |
|
1182 |
+
max_retries = 5
|
1183 |
+
|
1184 |
for attempt in range(max_retries):
|
1185 |
response = requests.post(API_URL, headers=headers, json=data)
|
1186 |
if response.status_code == 200:
|
|
|
1195 |
|
1196 |
if api_key == "":
|
1197 |
api_key = os.environ.get("HF_TOKEN")
|
1198 |
+
logging.debug("HUGGINGFACE API KEY CHECK: " + api_key)
|
1199 |
try:
|
1200 |
logging.debug("huggingface: Loading json data for summarization")
|
1201 |
with open(file_path, 'r') as file:
|
|
|
1205 |
text = ' '.join([segment['text'] for segment in segments])
|
1206 |
|
1207 |
api_key = os.environ.get('HF_TOKEN')
|
1208 |
+
logging.debug("HUGGINGFACE API KEY CHECK #2: " + api_key)
|
1209 |
|
1210 |
|
1211 |
|