-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3435ad0
commit 17f3df8
Showing
11 changed files
with
85 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from decouple import config | ||
|
||
DATABASE_URL = config('DATABASE_URL') |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from db.session import engine | ||
from models import audio_analysis | ||
|
||
def init_db(): | ||
audio_analysis.Base.metadata.create_all(bind=engine) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from sqlalchemy import create_engine | ||
from sqlalchemy.orm import sessionmaker | ||
from sqlalchemy.ext.declarative import declarative_base | ||
from config import DATABASE_URL | ||
|
||
|
||
engine = create_engine(DATABASE_URL) | ||
|
||
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) | ||
|
||
Base = declarative_base() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from db.session import SessionLocal | ||
|
||
def get_db(): | ||
db = SessionLocal() | ||
try: | ||
yield db | ||
finally: | ||
db.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,20 @@ | ||
from fastapi import FastAPI | ||
from fastapi import FastAPI, Depends | ||
from api.routes import audio | ||
from middlewares import cors_middleware | ||
from typing import Annotated | ||
from sqlalchemy.orm import Session | ||
from db.init_db import init_db | ||
from db.utils import get_db | ||
|
||
|
||
app = FastAPI() | ||
|
||
@app.on_event("startup") | ||
async def startup_event(): | ||
init_db() | ||
|
||
cors_middleware.setup_cors(app) | ||
|
||
app.include_router(audio.router) | ||
db_dependency = Annotated[Session, Depends(get_db)] | ||
|
||
app.include_router(audio.router) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from sqlalchemy import Column, String, Text, Integer, Float | ||
from db.session import Base | ||
|
||
class AudioAnalysis(Base): | ||
__tablename__ = 'audio_analysis' | ||
|
||
id = Column(Integer, primary_key=True, index=True) | ||
filename = Column(String(255)) | ||
summary = Column(Text) | ||
transcription = Column(Text) | ||
negative_score = Column(Float) | ||
neutral_score = Column(Float) | ||
positive_score = Column(Float) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.