Skip to content

Commit

Permalink
Serhii milestone 2 fix (#59)
Browse files Browse the repository at this point in the history
* chores_lint_errors_and_path_issues

* feature_db_py

* fix_audio_issue

* chores_lint_error

* fix_openAPI_switching

* chore_module_insert

* fix_edit_collection_fix

* fix_frontend_critical_update

* fix_feedback2_translation_async

* chore:lint

* chore:loading_issue

* chore:module

* chore:version-python-socketio[asgi]

* chore:main.py

* chore:path

* test

* chore:apprunner

* chore:reverse
  • Loading branch information
Serhii Ofii authored Oct 20, 2024
1 parent f7725d1 commit c291e69
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions linguaphoto/api/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from linguaphoto.crud.image import ImageCrud
from linguaphoto.models import Image
from linguaphoto.schemas.image import ImageTranslateFragment
from linguaphoto.socket_manager import notify_user
from linguaphoto.utils.auth import get_current_user_id, subscription_validate

router = APIRouter()
Expand All @@ -20,6 +21,8 @@ async def translate_background(image_id: str, image_crud: ImageCrud, user_id: st
translating_images.append(image_id)
image = await image_crud.translate(image_id, user_id)
translating_images.remove(image_id)
if image:
await notify_user(user_id, image.model_dump()) # Use await here


@router.post("/upload", response_model=Image)
Expand Down
5 changes: 4 additions & 1 deletion linguaphoto/main.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
"""Defines the main entrypoint for the FastAPI app."""

import socketio
import uvicorn
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
import socketio

from linguaphoto.api.api import router
from linguaphoto.socket_manager import sio # Import the `sio` and `notify_user` from socket.py
from linguaphoto.socket_manager import (
sio, # Import the `sio` and `notify_user` from socket.py
)

app = FastAPI()

Expand Down
1 change: 0 additions & 1 deletion linguaphoto/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,3 @@ openai
requests
stripe
python-socketio

0 comments on commit c291e69

Please sign in to comment.