Skip to content

Commit

Permalink
added api folder as sub folder in server folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Prudhvi-232 committed Oct 1, 2024
1 parent fdcd8c5 commit 5e680bb
Show file tree
Hide file tree
Showing 26 changed files with 26 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ function init() {

// var url = "http://127.0.0.1:5000/classify_image";
// var url = "/classify_image";
var url = "/api/classify_image"; // This should match your proxy configuration
// var url = "/api/classify_image"; // This should match your proxy configuration
var url = "/api/classify_image"; // This points to your backend on Vercel.



$.post(
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions server/api/classify_image.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from server import util
from flask import Flask, request, jsonify

app = Flask(__name__)

@app.route('/api/classify_image', methods=['POST'])
def classify_image():
image_data = request.form['image_data']
response = jsonify(util.classify_image(image_data))
response.headers.add('Access-Control-Allow-Origin', '*')
return response

if __name__ == "__main__":
util.load_saved_artifacts()
app.run()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"routes": [
{
"src": "/api/classify_image",
"dest": "/server/api/classify_image.py"
}
]
}

0 comments on commit 5e680bb

Please sign in to comment.