Spaces:
Running
Running
Commit
Β·
0cfd419
1
Parent(s):
c671ff0
Change max timeout
Browse files- app.py +1 -1
- constants.py +2 -1
app.py
CHANGED
|
@@ -18,7 +18,7 @@ def process(query_type, index_desc, **kwargs):
|
|
| 18 |
if API_URL is None:
|
| 19 |
raise ValueError(f'API_URL envvar is not set!')
|
| 20 |
try:
|
| 21 |
-
response = requests.post(API_URL, json=data, timeout=
|
| 22 |
except requests.exceptions.Timeout:
|
| 23 |
raise ValueError('Web request timed out. Please try again later.')
|
| 24 |
except requests.exceptions.RequestException as e:
|
|
|
|
| 18 |
if API_URL is None:
|
| 19 |
raise ValueError(f'API_URL envvar is not set!')
|
| 20 |
try:
|
| 21 |
+
response = requests.post(API_URL, json=data, timeout=MAX_TIMEOUT_IN_SECONDS)
|
| 22 |
except requests.exceptions.Timeout:
|
| 23 |
raise ValueError('Web request timed out. Please try again later.')
|
| 24 |
except requests.exceptions.RequestException as e:
|
constants.py
CHANGED
|
@@ -14,7 +14,8 @@ INDEX_DESCS = list(INDEX_BY_DESC.keys())
|
|
| 14 |
MAX_QUERY_CHARS = int(os.environ.get('MAX_QUERY_CHARS', 1000))
|
| 15 |
NGRAM_LEN_MIN = int(os.environ.get('NGRAM_LEN_MIN', 5))
|
| 16 |
NGRAM_LEN_MAX = int(os.environ.get('NGRAM_LEN_MAX', 11))
|
| 17 |
-
MAX_DISP_CHARS_PER_LINE = int(os.environ.get('MAX_DISP_CHARS_PER_LINE',
|
|
|
|
| 18 |
|
| 19 |
# HF demo
|
| 20 |
API_URL = os.environ.get('API_URL', None)
|
|
|
|
| 14 |
MAX_QUERY_CHARS = int(os.environ.get('MAX_QUERY_CHARS', 1000))
|
| 15 |
NGRAM_LEN_MIN = int(os.environ.get('NGRAM_LEN_MIN', 5))
|
| 16 |
NGRAM_LEN_MAX = int(os.environ.get('NGRAM_LEN_MAX', 11))
|
| 17 |
+
MAX_DISP_CHARS_PER_LINE = int(os.environ.get('MAX_DISP_CHARS_PER_LINE', 90))
|
| 18 |
+
MAX_TIMEOUT_IN_SECONDS = int(os.environ.get('MAX_TIMEOUT_IN_SECONDS', 60))
|
| 19 |
|
| 20 |
# HF demo
|
| 21 |
API_URL = os.environ.get('API_URL', None)
|