Commit 9d6e4630 authored by Lelkada L L P S M's avatar Lelkada L L P S M

backend file for card flip game

parent 6eefc77c
import numpy as np
from flask import Flask, request, jsonify
from flask import Flask, request, jsonify, request
import pickle
from word_card_game import wordGameData
app = Flask(__name__)
......
import random
def wordGameData(w1, w2, w3):
words = [w1, w2, w3]
main_word = random.choice(words)
card_words = random.sample(words, len(words))
card_word1, card_word2, card_word3 = card_words
def create_links(word):
image_link = f'https://fyp-word-images.s3.us-east-2.amazonaws.com/{word}.png'
audio_link = f'https://fyp-word-audio.s3.us-east-2.amazonaws.com/{word}.m4a'
return {'word': word, 'image_link': image_link, 'audio_link': audio_link}
return {
'main_word': create_links(main_word),
'card_word1': create_links(card_word1),
'card_word2': create_links(card_word2),
'card_word3': create_links(card_word3)
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment