code-bison

POST {{baseUrl}}/projects/{{projectId}}/locations/{{locationId}}/publishers/google/models/:model_id_action

Request Body

{"instances"=>[{"prefix"=>"Develop a Flask app for encyption and decryption"}]}

RESPONSES

status: OK

{"predictions":[{"citationMetadata":{"citations":[]},"score":-17.542190551757812,"safetyAttributes":{"blocked":false,"categories":["Finance","Health"],"scores":[0.1,0.1]},"content":"```python\nfrom flask import Flask, request, render_template\nimport base64\n\napp = Flask(__name__)\n\n@app.route('/')\ndef index():\n    return render_template('index.html')\n\n@app.route('/encrypt', methods=['POST'])\ndef encrypt():\n    text = request.form.get('text')\n    encoded_bytes = base64.b64encode(text.encode('utf-8'))\n    encoded_text = encoded_bytes.decode('utf-8')\n    return render_template('index.html', encrypted_text=encoded_text)\n\n@app.route('/decrypt', methods=['POST'])\ndef decrypt():\n    text = request.form.get('text')\n    decoded_bytes = base64.b64decode(text.encode('utf-8'))\n    decoded_text = decoded_bytes.decode('utf-8')\n    return render_template('index.html', decrypted_text=decoded_text)\n\nif __name__ == '__main__':\n    app.run(debug=True)\n```"}],"metadata":{"tokenMetadata":{"outputTokenCount":{"totalBillableCharacters":666,"totalTokens":239},"inputTokenCount":{"totalTokens":10,"totalBillableCharacters":41}}}}