Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -6,3 +6,19 @@ app = Flask(__name__)
|
|
6 |
def hello():
|
7 |
return "Hello, World! This is my Flask app running on Hugging Face!"
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
def hello():
|
7 |
return "Hello, World! This is my Flask app running on Hugging Face!"
|
8 |
|
9 |
+
@app.route('/api/<message>')
|
10 |
+
def handle_message(message):
|
11 |
+
"""Handles API requests to the /<message> route.
|
12 |
+
|
13 |
+
Args:
|
14 |
+
message (str): The message string to be printed.
|
15 |
+
|
16 |
+
Returns:
|
17 |
+
str: A JSON response containing the printed message.
|
18 |
+
"""
|
19 |
+
|
20 |
+
# Print the message for logging or debugging purposes
|
21 |
+
print(f"Received message: {message}")
|
22 |
+
|
23 |
+
# Return a JSON response with the message for API consumption
|
24 |
+
return jsonify({"message": message})
|