Download app.py from ON3121/chatbot: direct link, hf CLI and curl.
- Browser
- Download file 575 Bytes
-
https://huggingface.co/spaces/ON3121/chatbot/resolve/main/app.py
- Command line
-
hf download hf://spaces/ON3121/chatbot/app.py
-
curl -L -o app.py https://huggingface.co/spaces/ON3121/chatbot/resolve/main/app.py
575 Bytes
| from flask import Flask, request, jsonify, render_template | |
| import chatbot # Import your chatbot logic from chatbot.py | |
| app = Flask(__name__) | |
| def index(): | |
| return render_template("index.html") | |
| def ask(): | |
| data = request.get_json() | |
| question = data.get("question") | |
| if not question: | |
| return jsonify({"answer": "No question provided."}) | |
| answer = chatbot.chatbot_response(question) | |
| return jsonify({"answer": answer}) | |
| if __name__ == "__main__": | |
| app.run(host="0.0.0.0", port=8080, debug=True) | |