from flask import Flask, request, jsonify def generate_prompt(user_input, ai_model="ChatGPT"): return f"Generate a professional and detailed AI prompt for {ai_model} based on the following input: '{user_input}'. The prompt should be structured, engaging, and optimized for the best response. Output only the generated prompt without additional explanations." app = Flask(__name__) @app.route('/generate', methods=['POST']) def generate(): data = request.json user_input = data.get("input", "") ai_model = data.get("ai_model", "ChatGPT") if not user_input: return jsonify({"error": "Input text is required."}), 400 prompt = generate_prompt(user_input, ai_model) return jsonify({"generated_prompt": prompt}) if __name__ == '__main__': app.run(debug=True)

Post a Comment

0 Comments