File size: 553 Bytes
0c89d71
 
9599633
 
 
0c89d71
 
 
9599633
 
0c89d71
9599633
 
 
0c89d71
 
 
 
 
 
9599633
 
0c89d71
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from flask import Flask, request, jsonify
import logging

app = Flask(__name__)

# Configure logging to display outputs in Hugging Face logs
logging.basicConfig(level=logging.INFO)

@app.route('/')
def index():
    return 'Hello, Webhook Receiver!'

@app.route('/json', methods=['POST'])
def handle_json():
    data = request.get_json()

    # Log the request for debugging
    logging.info(f"Received JSON: {data}")

    return jsonify(data), 200  # Return JSON response with HTTP 200

if __name__ == '__main__':
    app.run(host="0.0.0.0", port=7860)