Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,7 +2,7 @@ from flask import Flask, request, jsonify
|
|
| 2 |
from gradio_client import Client
|
| 3 |
import os
|
| 4 |
|
| 5 |
-
app = Flask(
|
| 6 |
|
| 7 |
@app.route("/ask", methods=["POST"])
|
| 8 |
def ask_question():
|
|
@@ -14,12 +14,13 @@ def ask_question():
|
|
| 14 |
result = client.predict(input_text, api_name="/predict")
|
| 15 |
return jsonify({"question": result})
|
| 16 |
except Exception as e:
|
|
|
|
| 17 |
return jsonify({"error": str(e)}), 500
|
| 18 |
-
|
| 19 |
@app.route("/", methods=["GET"])
|
| 20 |
def index():
|
| 21 |
return "Flan5 Memorease Docker Space is running!", 200
|
| 22 |
|
| 23 |
-
if
|
| 24 |
port = int(os.environ.get("PORT", 7860))
|
| 25 |
-
app.run(host="0.0.0.0",
|
|
|
|
| 2 |
from gradio_client import Client
|
| 3 |
import os
|
| 4 |
|
| 5 |
+
app = Flask(__name__)
|
| 6 |
|
| 7 |
@app.route("/ask", methods=["POST"])
|
| 8 |
def ask_question():
|
|
|
|
| 14 |
result = client.predict(input_text, api_name="/predict")
|
| 15 |
return jsonify({"question": result})
|
| 16 |
except Exception as e:
|
| 17 |
+
print("SERVER ERROR:", str(e))
|
| 18 |
return jsonify({"error": str(e)}), 500
|
| 19 |
+
|
| 20 |
@app.route("/", methods=["GET"])
|
| 21 |
def index():
|
| 22 |
return "Flan5 Memorease Docker Space is running!", 200
|
| 23 |
|
| 24 |
+
if __name__ == "__main__":
|
| 25 |
port = int(os.environ.get("PORT", 7860))
|
| 26 |
+
app.run(host="0.0.0.0", port=port)
|