Update app.py
Browse files
app.py
CHANGED
@@ -63,16 +63,13 @@ def answer():
|
|
63 |
logging.error(f"API error: {e}")
|
64 |
return jsonify({"error": str(e)}), 500
|
65 |
|
66 |
-
# Health check
|
67 |
-
@app.route("/", methods=["GET"])
|
68 |
def health_check():
|
69 |
-
return jsonify({"status": "API is running, use /api/answer for API or Gradio interface"}), 200
|
70 |
|
71 |
# Phục vụ Gradio ở root
|
72 |
-
|
73 |
-
@app.route("/<path:path>", methods=["GET", "POST"])
|
74 |
-
def serve_gradio(path=None):
|
75 |
-
return iface.__call__(request)
|
76 |
|
77 |
if __name__ == "__main__":
|
78 |
logging.info("Starting Flask and Gradio app on port 7860...")
|
|
|
63 |
logging.error(f"API error: {e}")
|
64 |
return jsonify({"error": str(e)}), 500
|
65 |
|
66 |
+
# Health check (chỉ dùng khi cần debug)
|
67 |
+
@app.route("/health", methods=["GET"])
|
68 |
def health_check():
|
69 |
+
return jsonify({"status": "API is running, use /api/answer for API or / for Gradio interface"}), 200
|
70 |
|
71 |
# Phục vụ Gradio ở root
|
72 |
+
app = gr.mount_gradio_app(app, iface, path="/")
|
|
|
|
|
|
|
73 |
|
74 |
if __name__ == "__main__":
|
75 |
logging.info("Starting Flask and Gradio app on port 7860...")
|