Update app.py
Browse files126 unmodified lines127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166126 unmodified linesreturn jsonify(translation)# Configure the API keypalm.configure(api_key="AIzaSyDmHbZlWJJBlaW5BAJwfOu7HP-JAKFiCpY")defaults = {'model': 'models/text-bison-001','temperature': 1,'candidate_count': 1,'top_k': 40,'top_p': 0.95,'max_output_tokens': 1024,'stop_sequences': [],'safety_settings': [{"category": "HARM_CATEGORY_DEROGATORY", "threshold": "BLOCK_NONE"},{"category": "HARM_CATEGORY_TOXICITY", "threshold": "BLOCK_NONE"},{"category": "HARM_CATEGORY_VIOLENCE", "threshold": "BLOCK_NONE"},{"category": "HARM_CATEGORY_SEXUAL", "threshold": "BLOCK_NONE"},{"category": "HARM_CATEGORY_MEDICAL", "threshold": "BLOCK_NONE"},{"category": "HARM_CATEGORY_DANGEROUS", "threshold": "BLOCK_NONE"},]}@app.route('/chat', methods=['POST'])def generate():data = request.get_json()prompt = data.get('prompt', 'You are A helpfull AI that will follow users instructions.')# Call the generate functionresult = palm.generate_text(**defaults,prompt=prompt)return jsonify({'response': result.result})@app.route('/gpt', methods=['POST'])def chat_gpt():user_input = request.json.get('message')if user_input is None:126 unmodified lines127128129130131132133134126 unmodified linesreturn jsonify(translation)# Configure the API key@app.route('/chat', methods=['POST'])def chat_gpt():user_input = request.json.get('message')if user_input is None:
app.py+1-33