CoolFace
Apppublic

23f3003433/llm-code-deployment

sourceHugging Facemitupdated 11mo agoView on Hugging Face
0likes
app.py43 linesDownload Raw Back to root
1from flask import Flask, request, jsonify2import os3 4app = Flask(__name__)5MY_SECRET = os.getenv('SECRET', 'default_secret')6 7@app.route('/')8def home():9    return "LLM Code Deployment API is running!"10 11@app.route('/health', methods=['GET'])12def health():13    return jsonify({"status": "healthy"}), 20014 15@app.route('/api-endpoint', methods=['POST'])16def handle_request():17    data = request.json18    19    # Verify secret20    if data.get('secret') != MY_SECRET:21        return jsonify({"error": "Invalid secret"}), 40022 23    try:24        email = data.get('email')25        task = data.get('task')26        brief = data.get('brief')27        28        # Simple response29        response = {30            "status": "success", 31            "message": "Request received successfully",32            "email": email,33            "task": task,34            "round": data.get('round', 1)35        }36        37        return jsonify(response), 20038 39    except Exception as e:40        return jsonify({"error": "Internal server error"}), 50041 42if __name__ == '__main__':43    app.run(host='0.0.0.0', port=7860, debug=False)