How can I fix my Flask server’s 405 error that includes OpenAi api?
Im trying to make add an api into my webpage and have never used any Flask server before, I have never used Javascript too so this is a completely brand new learning expirience. My problem is that I keep recieiveing a 405 error code saying that the method is not allowed. I keep on using the POST method but it isnt working, I am banking that my issue maybe with my html code more than my flask server because the code is extremly generic and simple.
Learning FLask: Stuck at OpenAI api
from flask import Flask, request, jsonify, send_from_directory import openai from openai import OpenAI import os app = Flask(__name__) openai.api_key = ‘sk-‘ # I added my key here. @app.route(‘/’) def index(): return send_from_directory(‘.’, ‘index.html’) @app.route(‘/analyze’, methods=[‘POST’]) def analyze_cv(): if ‘cv’ not in request.files or ‘job_description’ not in request.files: return jsonify({‘error’: ‘CV and Job Description files are […]