Update app.py
Browse files
app.py
CHANGED
|
@@ -22,6 +22,14 @@ model.eval()
|
|
| 22 |
|
| 23 |
print("Modelo cargado correctamente.")
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
@app.route("/chat", methods=["POST"])
|
| 26 |
def chat():
|
| 27 |
try:
|
|
@@ -48,7 +56,6 @@ def chat():
|
|
| 48 |
)
|
| 49 |
|
| 50 |
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 51 |
-
|
| 52 |
response = response.split("Assistant:")[-1].strip()
|
| 53 |
|
| 54 |
return jsonify({"response": response})
|
|
|
|
| 22 |
|
| 23 |
print("Modelo cargado correctamente.")
|
| 24 |
|
| 25 |
+
@app.route("/", methods=["GET"])
|
| 26 |
+
def home():
|
| 27 |
+
return jsonify({
|
| 28 |
+
"status": "online",
|
| 29 |
+
"model": MODEL_NAME,
|
| 30 |
+
"endpoint": "POST /chat"
|
| 31 |
+
})
|
| 32 |
+
|
| 33 |
@app.route("/chat", methods=["POST"])
|
| 34 |
def chat():
|
| 35 |
try:
|
|
|
|
| 56 |
)
|
| 57 |
|
| 58 |
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
|
|
|
| 59 |
response = response.split("Assistant:")[-1].strip()
|
| 60 |
|
| 61 |
return jsonify({"response": response})
|