Spaces:
Sleeping
Sleeping
revert back to - remove buffering
Browse files
app.py
CHANGED
|
@@ -47,7 +47,7 @@ app.config["JWT_SECRET_KEY"] = os.environ.get("JWT_SECRET_KEY")
|
|
| 47 |
app.config["JWT_ACCESS_TOKEN_EXPIRES"] = timedelta(hours=24)
|
| 48 |
jwt = JWTManager(app)
|
| 49 |
|
| 50 |
-
BACKEND_BASE = "
|
| 51 |
HF_TOKEN = os.environ.get("HF_TOKEN")
|
| 52 |
|
| 53 |
|
|
@@ -203,7 +203,7 @@ def proxy_chat():
|
|
| 203 |
f"{BACKEND_BASE}/chat",
|
| 204 |
json=payload,
|
| 205 |
headers={"Authorization": f"Bearer {HF_TOKEN}"},
|
| 206 |
-
timeout=
|
| 207 |
)
|
| 208 |
except Exception as e:
|
| 209 |
return jsonify({"ok": False, "error": f"Gateway request failed: {e}"}), 502
|
|
@@ -279,7 +279,7 @@ def proxy_prolog_query():
|
|
| 279 |
f"{BACKEND_BASE}/prolog/query",
|
| 280 |
json=payload,
|
| 281 |
headers={"Authorization": f"Bearer {HF_TOKEN}"},
|
| 282 |
-
timeout=
|
| 283 |
)
|
| 284 |
except Exception as e:
|
| 285 |
return jsonify({"ok": False, "error": f"Gateway request failed: {e}"}), 502
|
|
@@ -313,7 +313,7 @@ def proxy_prolog_prove():
|
|
| 313 |
f"{BACKEND_BASE}/prolog/prove",
|
| 314 |
json=payload,
|
| 315 |
headers={"Authorization": f"Bearer {HF_TOKEN}"},
|
| 316 |
-
timeout=
|
| 317 |
)
|
| 318 |
except Exception as e:
|
| 319 |
return jsonify({"ok": False, "error": f"Gateway request failed: {e}"}), 502
|
|
@@ -672,5 +672,5 @@ def health():
|
|
| 672 |
# MAIN
|
| 673 |
# ============================================================
|
| 674 |
if __name__ == "__main__":
|
| 675 |
-
port = int(os.environ.get("PORT",
|
| 676 |
app.run(host="0.0.0.0", port=port)
|
|
|
|
| 47 |
app.config["JWT_ACCESS_TOKEN_EXPIRES"] = timedelta(hours=24)
|
| 48 |
jwt = JWTManager(app)
|
| 49 |
|
| 50 |
+
BACKEND_BASE = "https://deepthoughtai-prolog-backend.hf.space"
|
| 51 |
HF_TOKEN = os.environ.get("HF_TOKEN")
|
| 52 |
|
| 53 |
|
|
|
|
| 203 |
f"{BACKEND_BASE}/chat",
|
| 204 |
json=payload,
|
| 205 |
headers={"Authorization": f"Bearer {HF_TOKEN}"},
|
| 206 |
+
timeout=60,
|
| 207 |
)
|
| 208 |
except Exception as e:
|
| 209 |
return jsonify({"ok": False, "error": f"Gateway request failed: {e}"}), 502
|
|
|
|
| 279 |
f"{BACKEND_BASE}/prolog/query",
|
| 280 |
json=payload,
|
| 281 |
headers={"Authorization": f"Bearer {HF_TOKEN}"},
|
| 282 |
+
timeout=60,
|
| 283 |
)
|
| 284 |
except Exception as e:
|
| 285 |
return jsonify({"ok": False, "error": f"Gateway request failed: {e}"}), 502
|
|
|
|
| 313 |
f"{BACKEND_BASE}/prolog/prove",
|
| 314 |
json=payload,
|
| 315 |
headers={"Authorization": f"Bearer {HF_TOKEN}"},
|
| 316 |
+
timeout=60,
|
| 317 |
)
|
| 318 |
except Exception as e:
|
| 319 |
return jsonify({"ok": False, "error": f"Gateway request failed: {e}"}), 502
|
|
|
|
| 672 |
# MAIN
|
| 673 |
# ============================================================
|
| 674 |
if __name__ == "__main__":
|
| 675 |
+
port = int(os.environ.get("PORT", 7860))
|
| 676 |
app.run(host="0.0.0.0", port=port)
|