Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from flask import Flask, request, jsonify
|
2 |
+
|
3 |
+
app = Flask(__name__)
|
4 |
+
|
5 |
+
@app.route("/")
|
6 |
+
def home():
|
7 |
+
return "Hello! Your Flask app is running on Hugging Face Spaces 🚀"
|
8 |
+
|
9 |
+
@app.route("/chat", methods=["POST"])
|
10 |
+
def chat():
|
11 |
+
user_input = request.json.get("message", "")
|
12 |
+
if not user_input:
|
13 |
+
return jsonify({"error": "Empty input"}), 400
|
14 |
+
|
15 |
+
return jsonify({"response": f"Dummy response for: {user_input}"})
|
16 |
+
|
17 |
+
if __name__ == "__main__":
|
18 |
+
app.run(host="0.0.0.0", port=7860)
|