memorease commited on
Commit
ad9dfac
·
verified ·
1 Parent(s): 8cfb7eb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
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(_name_)
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 _name_ == "_main_":
24
  port = int(os.environ.get("PORT", 7860))
25
- app.run(host="0.0.0.0", port=port)
 
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)