mirror of
https://gitea.smigz.com/smiggiddy/odin-codeprojects.git
synced 2025-06-28 21:05:36 -04:00
feat: added more stuff
This commit is contained in:
parent
2c7bbfb044
commit
4902ed48f9
6 changed files with 103 additions and 31 deletions
|
@ -6,6 +6,7 @@ from fastapi import Depends, FastAPI
|
|||
from fastapi.middleware.cors import CORSMiddleware
|
||||
import logging
|
||||
import requests
|
||||
from random import shuffle
|
||||
import os
|
||||
from .photos import Pictures
|
||||
|
||||
|
@ -78,11 +79,14 @@ def ai_cards(card: schemas.CardCreate, db: Session = Depends(get_db)):
|
|||
@app.get("/cards")
|
||||
def read_cards(skip: int = 0, limit: int = 100, db: Session = Depends(get_db)):
|
||||
cards = crud.get_cards(db, skip=skip, limit=limit)
|
||||
|
||||
# return the items in a random order for the game
|
||||
shuffle(cards)
|
||||
return cards
|
||||
|
||||
|
||||
@app.get("/load-data")
|
||||
def load_data():
|
||||
async def load_data():
|
||||
topics = ai.generate_topics()
|
||||
|
||||
try:
|
||||
|
@ -90,8 +94,6 @@ def load_data():
|
|||
|
||||
logger.info(item)
|
||||
picture_data = photos.search(item["topic"])
|
||||
logger.info(picture_data)
|
||||
break
|
||||
|
||||
card_json = ai.generate_card_json(picture_data, item)
|
||||
logger.info(card_json)
|
||||
|
|
BIN
memory-game/mg-backend/memory_game.db
Normal file
BIN
memory-game/mg-backend/memory_game.db
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue