Spaces:
Sleeping
Sleeping
File size: 685 Bytes
93a2217 a06056d 5517f9c e3db2f8 93a2217 207c16a bf5c1c9 93a2217 c36c2b7 93a2217 207c16a 93a2217 218ed52 9920987 93a2217 9920987 93a2217 5e6c5aa |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
from flask import Flask, request, render_template, jsonify
from models import mixtral
# https://www.youtube.com/watch?v=irjYqV6EebU
app = Flask("AI API")
@app.get("/")
def read_root():
return render_template("index.html")
@app.route("/test")
def test_route():
return "This is a test route."
@app.route("/api", methods=["POST"])
def receive_data():
data = request.get_json()
print("Prompt:", data["prompt"])
generated_text = mixtral.generate(data["prompt"], data["system"], data["history"], False, None)
answer_data = { "answer": generated_text }
print("Response:", generated_text)
return jsonify(answer_data)
app.run(host="0.0.0.0", port=7860, debug=False) |