Spaces:
Running
Running
Commit
·
f0ed1e5
1
Parent(s):
5516522
Undid shi
Browse files
main.py
CHANGED
@@ -1,7 +1,5 @@
|
|
1 |
from flask import Flask, request, render_template, jsonify
|
2 |
-
from models import
|
3 |
-
|
4 |
-
# https://www.youtube.com/watch?v=irjYqV6EebU
|
5 |
|
6 |
app = Flask("AI API")
|
7 |
|
@@ -16,14 +14,12 @@ def test_route():
|
|
16 |
@app.route("/api", methods=["POST"])
|
17 |
def receive_data():
|
18 |
data = request.get_json()
|
19 |
-
|
20 |
print("Prompt:", data["prompt"])
|
21 |
-
print("System:", data["system"])
|
22 |
|
23 |
-
generated_text =
|
24 |
|
25 |
print("Response:", generated_text)
|
26 |
|
27 |
-
return { "answer": generated_text }
|
28 |
|
29 |
app.run(host="0.0.0.0", port=7860, debug=False)
|
|
|
1 |
from flask import Flask, request, render_template, jsonify
|
2 |
+
from models import blenderbot
|
|
|
|
|
3 |
|
4 |
app = Flask("AI API")
|
5 |
|
|
|
14 |
@app.route("/api", methods=["POST"])
|
15 |
def receive_data():
|
16 |
data = request.get_json()
|
|
|
17 |
print("Prompt:", data["prompt"])
|
|
|
18 |
|
19 |
+
generated_text = blenderbot.generate(data["prompt"])
|
20 |
|
21 |
print("Response:", generated_text)
|
22 |
|
23 |
+
return jsonify({ "answer": generated_text })
|
24 |
|
25 |
app.run(host="0.0.0.0", port=7860, debug=False)
|