Futuresony commited on
Commit
f663a95
·
verified ·
1 Parent(s): f3046d5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -20,15 +20,15 @@ def fetch_message():
20
  if not message:
21
  return jsonify({"error": "No input provided."}), 400
22
 
23
-
24
-
25
  # Process the message using the Hugging Face model
26
  try:
27
  response = client.text_generation(message)
28
  return jsonify({"response": response})
29
-
 
 
30
  if __name__ == "__main__":
31
  # Use PORT environment variable or default to 7860
32
  port = int(os.getenv("PORT", 7860))
33
-
34
- app.run(host="0.0.0.0", port=port)
 
20
  if not message:
21
  return jsonify({"error": "No input provided."}), 400
22
 
 
 
23
  # Process the message using the Hugging Face model
24
  try:
25
  response = client.text_generation(message)
26
  return jsonify({"response": response})
27
+ except Exception as e:
28
+ return jsonify({"error": f"An error occurred: {str(e)}"}), 500
29
+
30
  if __name__ == "__main__":
31
  # Use PORT environment variable or default to 7860
32
  port = int(os.getenv("PORT", 7860))
33
+ app.run(host="0.0.0.0", port=port)
34
+