Skip to content

Commit

Permalink
style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nnayk committed Dec 6, 2023
1 parent c3560bd commit 84a42e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
7 changes: 4 additions & 3 deletions Backend/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@ def generate_image():

return r.json()

#gets a random image from the database

# gets a random image from the database
@app.route("/get_random_image", methods=["GET"])
def get_random_image():
try:
# Randomly select an image
image = Image.objects.aggregate([{'$sample': {'size': 1}}]).next()
image = Image.objects.aggregate([{"$sample": {"size": 1}}]).next()
return jsonify(image), 200
except StopIteration:
# No images found in the database
Expand All @@ -57,6 +58,7 @@ def get_random_image():
# Handle other exceptions
return jsonify({"error": str(e)}), 500


@app.route("/update_image_elo", methods=["POST"])
def update_image_elo():
data = request.get_json()
Expand All @@ -76,7 +78,6 @@ def update_image_elo():
return jsonify({"error": str(e)}), 500



@app.route("/store_image", methods=["POST"])
def store_image():
data = request.get_json()
Expand Down
5 changes: 1 addition & 4 deletions Backend/db_access.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from flask import Flask, jsonify, request
from mongoengine import (
connect,
Expand All @@ -7,8 +8,6 @@
ReferenceField,
NotUniqueError,
)
import json

from werkzeug.security import check_password_hash
import secrets
from mongoengine.errors import DoesNotExist
Expand All @@ -17,8 +16,6 @@

load_dotenv()

import os

app = Flask(__name__)


Expand Down

0 comments on commit 84a42e8

Please sign in to comment.