Spaces:
Sleeping
Sleeping
changed generation timeout for 3 seconds to include latency.
Browse files
app.ipynb
CHANGED
|
@@ -183,7 +183,7 @@
|
|
| 183 |
" return jsonify({'error': 'Generation model not loaded.'}), 500\n",
|
| 184 |
" try:\n",
|
| 185 |
" start_time = time.time()\n",
|
| 186 |
-
" timeout =
|
| 187 |
" while time.time() - start_time < timeout:\n",
|
| 188 |
" seed = random.choice(POLITICAL_SEEDS)\n",
|
| 189 |
" output = generator(\n",
|
|
|
|
| 183 |
" return jsonify({'error': 'Generation model not loaded.'}), 500\n",
|
| 184 |
" try:\n",
|
| 185 |
" start_time = time.time()\n",
|
| 186 |
+
" timeout = 3 # 3 second limit\n",
|
| 187 |
" while time.time() - start_time < timeout:\n",
|
| 188 |
" seed = random.choice(POLITICAL_SEEDS)\n",
|
| 189 |
" output = generator(\n",
|
app.py
CHANGED
|
@@ -126,7 +126,7 @@ def generate():
|
|
| 126 |
return jsonify({'error': 'Generation model not loaded.'}), 500
|
| 127 |
try:
|
| 128 |
start_time = time.time()
|
| 129 |
-
timeout =
|
| 130 |
while time.time() - start_time < timeout:
|
| 131 |
seed = random.choice(POLITICAL_SEEDS)
|
| 132 |
output = generator(
|
|
|
|
| 126 |
return jsonify({'error': 'Generation model not loaded.'}), 500
|
| 127 |
try:
|
| 128 |
start_time = time.time()
|
| 129 |
+
timeout = 3 # 3 second limit
|
| 130 |
while time.time() - start_time < timeout:
|
| 131 |
seed = random.choice(POLITICAL_SEEDS)
|
| 132 |
output = generator(
|