diff --git a/.streamlit/config.toml b/.streamlit/config.toml deleted file mode 100644 index 320a53e..0000000 --- a/.streamlit/config.toml +++ /dev/null @@ -1,6 +0,0 @@ -[browser] -gatherUsageStats = false - - -[client] -showSidebarNavigation = false \ No newline at end of file diff --git a/pyproject.toml b/api/pyproject.toml similarity index 100% rename from pyproject.toml rename to api/pyproject.toml diff --git a/requirements.txt b/api/requirements.txt similarity index 100% rename from requirements.txt rename to api/requirements.txt index 8491f24..83f1cbf 100644 --- a/requirements.txt +++ b/api/requirements.txt @@ -1,34 +1,34 @@ +anthropic +asyncio +elevenlabs fastapi -pydantic fastapi-utilities +ffmpeg-python -uvicorn +firebase-admin +google-api-python-client +google-auth +google-cloud-storage +google-generativeai gunicorn -uvloop - -streamlit httpx -asyncio openai -anthropic -elevenlabs +pycairo +pydantic + +pydub +python-dotenv python-multipart python-slugify -python-dotenv -ffmpeg-python -pydub +ruff seewav -pycairo +setuptools -firebase-admin -google-auth -google-cloud-storage -google-api-python-client -google-generativeai +streamlit -ruff +uvicorn +uvloop watchdog -setuptools diff --git a/setup.py b/api/setup.py similarity index 100% rename from setup.py rename to api/setup.py diff --git a/env_var.py b/api/src/env_var.py similarity index 100% rename from env_var.py rename to api/src/env_var.py diff --git a/api/src/main.py b/api/src/main.py index 9b9ec08..2852d45 100644 --- a/api/src/main.py +++ b/api/src/main.py @@ -4,19 +4,19 @@ from fastapi import BackgroundTasks, FastAPI, Request from fastapi.middleware.cors import CORSMiddleware from fastapi_utilities import add_timer_middleware -from utils.chat_utils import ( + +from src.utils.chat_request import chat_request +from src.utils.chat_utils import ( SessionChatMessage, SessionChatRequest, ) -from utils.session_manager import SessionManager - -from src.utils.chat_request import chat_request from src.utils.generate_audiocast import ( GenerateAudioCastRequest, GenerateAudioCastResponse, generate_audiocast, ) from src.utils.get_audiocast import get_audiocast +from src.utils.session_manager import SessionManager app = FastAPI(title="Audiora", version="1.0.0") diff --git a/api/src/services/__init__.py b/api/src/services/__init__.py index ceb7a4e..7afb91a 100644 --- a/api/src/services/__init__.py +++ b/api/src/services/__init__.py @@ -1,3 +1,3 @@ -from services.admin_sdk import init_admin_sdk +from src.services.admin_sdk import init_admin_sdk init_admin_sdk() diff --git a/api/src/services/anthropic_client.py b/api/src/services/anthropic_client.py index d191d8d..dacb5cb 100644 --- a/api/src/services/anthropic_client.py +++ b/api/src/services/anthropic_client.py @@ -1,6 +1,6 @@ from anthropic import Anthropic, AsyncAnthropic -from env_var import ANTHROPIC_API_KEY +from api.src.env_var import ANTHROPIC_API_KEY def get_anthropic(): diff --git a/api/src/services/elevenlabs_client.py b/api/src/services/elevenlabs_client.py index d3f8468..68aa242 100644 --- a/api/src/services/elevenlabs_client.py +++ b/api/src/services/elevenlabs_client.py @@ -1,6 +1,6 @@ from elevenlabs.client import ElevenLabs -from env_var import ELEVENLABS_API_KEY +from api.src.env_var import ELEVENLABS_API_KEY client = ElevenLabs( api_key=ELEVENLABS_API_KEY, diff --git a/api/src/services/gemini_client.py b/api/src/services/gemini_client.py index e4f0aed..470fc8c 100644 --- a/api/src/services/gemini_client.py +++ b/api/src/services/gemini_client.py @@ -3,7 +3,7 @@ import google.generativeai as genai -from env_var import GEMINI_API_KEY +from api.src.env_var import GEMINI_API_KEY def get_gemini(): diff --git a/api/src/services/openai_client.py b/api/src/services/openai_client.py index fc545f6..8e31e22 100644 --- a/api/src/services/openai_client.py +++ b/api/src/services/openai_client.py @@ -1,6 +1,6 @@ from openai import Client -from env_var import OPENAI_API_KEY +from api.src.env_var import OPENAI_API_KEY def get_openai(): diff --git a/api/src/services/storage.py b/api/src/services/storage.py index bb8c661..27cc322 100644 --- a/api/src/services/storage.py +++ b/api/src/services/storage.py @@ -8,7 +8,7 @@ from google.cloud import storage from pydub import AudioSegment -from env_var import BUCKET_NAME +from api.src.env_var import BUCKET_NAME storage_client = storage.Client() bucket = storage_client.bucket(BUCKET_NAME) diff --git a/api/src/utils/audiocast_request.py b/api/src/utils/audiocast_request.py index e529539..3276080 100644 --- a/api/src/utils/audiocast_request.py +++ b/api/src/utils/audiocast_request.py @@ -1,11 +1,10 @@ import re from typing import Literal -from services.anthropic_client import get_anthropic_sync -from services.gemini_client import GeminiConfig, generate_content -from services.openai_client import get_openai -from utils.chat_utils import ContentCategory - +from src.services.anthropic_client import get_anthropic_sync +from src.services.gemini_client import GeminiConfig, generate_content +from src.services.openai_client import get_openai +from src.utils.chat_utils import ContentCategory from src.utils.prompt_templates.source_content_prompt import get_content_source_prompt from src.utils.prompt_templates.streamline_audio import streamline_audio_script_prompt from src.utils.prompt_templates.tts_prompt import Metadata, TTSPromptMaker diff --git a/api/src/utils/audiocast_utils.py b/api/src/utils/audiocast_utils.py index d99ffe3..91a578c 100644 --- a/api/src/utils/audiocast_utils.py +++ b/api/src/utils/audiocast_utils.py @@ -1,7 +1,8 @@ from typing import TypedDict from pydantic import BaseModel -from utils.chat_utils import ContentCategory + +from src.utils.chat_utils import ContentCategory class GenerateAudioCastRequest(BaseModel): diff --git a/api/src/utils/chat_request.py b/api/src/utils/chat_request.py index fcfda8e..d7babd0 100644 --- a/api/src/utils/chat_request.py +++ b/api/src/utils/chat_request.py @@ -1,7 +1,7 @@ from typing import Any, Callable, List, Optional -from services.openai_client import get_openai -from utils.chat_utils import ContentCategory, SessionChatMessage +from src.services.openai_client import get_openai +from src.utils.chat_utils import ContentCategory, SessionChatMessage def get_system_message(content_category: ContentCategory): diff --git a/api/src/utils/generate_audiocast.py b/api/src/utils/generate_audiocast.py index 20f845f..5c73570 100644 --- a/api/src/utils/generate_audiocast.py +++ b/api/src/utils/generate_audiocast.py @@ -1,16 +1,16 @@ from datetime import datetime from fastapi import BackgroundTasks, HTTPException -from services.storage import StorageManager -from utils.audiocast_utils import ( - GenerateAudioCastRequest, - GenerateAudioCastResponse, -) -from utils.session_manager import SessionManager -from utils.waveform_utils import WaveformUtils +from src.services.storage import StorageManager from src.utils.audio_manager import AudioManager, AudioManagerConfig from src.utils.audiocast_request import AudioScriptMaker, generate_source_content +from src.utils.audiocast_utils import ( + GenerateAudioCastRequest, + GenerateAudioCastResponse, +) +from src.utils.session_manager import SessionManager +from src.utils.waveform_utils import WaveformUtils async def generate_audiocast(request: GenerateAudioCastRequest, background_tasks: BackgroundTasks): diff --git a/api/src/utils/generate_speech_utils.py b/api/src/utils/generate_speech_utils.py index dfc0d14..429f036 100644 --- a/api/src/utils/generate_speech_utils.py +++ b/api/src/utils/generate_speech_utils.py @@ -2,9 +2,9 @@ from io import BytesIO from typing import Dict, List, Literal -from services.elevenlabs_client import get_elevenlabs_client -from services.openai_client import get_openai -from utils.decorators import process_time +from src.services.elevenlabs_client import get_elevenlabs_client +from src.services.openai_client import get_openai +from src.utils.decorators import process_time TTSProvider = Literal["openai", "elevenlabs"] diff --git a/api/src/utils/get_audiocast.py b/api/src/utils/get_audiocast.py index 8405b59..1618e2f 100644 --- a/api/src/utils/get_audiocast.py +++ b/api/src/utils/get_audiocast.py @@ -1,12 +1,12 @@ from datetime import datetime from fastapi import HTTPException -from services.storage import StorageManager -from utils.session_manager import SessionManager +from src.services.storage import StorageManager from src.utils.generate_audiocast import ( GenerateAudioCastResponse, ) +from src.utils.session_manager import SessionManager def get_audiocast(session_id: str): diff --git a/api/src/utils/prompt_templates/source_content_prompt.py b/api/src/utils/prompt_templates/source_content_prompt.py index a660c16..33b2fad 100644 --- a/api/src/utils/prompt_templates/source_content_prompt.py +++ b/api/src/utils/prompt_templates/source_content_prompt.py @@ -1,4 +1,4 @@ -from utils.chat_utils import ContentCategory, category_qualifiers +from src.utils.chat_utils import ContentCategory, category_qualifiers def get_content_source_prompt(category: ContentCategory, summary: str): diff --git a/api/src/utils/prompt_templates/tts_prompt.py b/api/src/utils/prompt_templates/tts_prompt.py index f1ad508..474d1fa 100644 --- a/api/src/utils/prompt_templates/tts_prompt.py +++ b/api/src/utils/prompt_templates/tts_prompt.py @@ -1,6 +1,6 @@ from dataclasses import dataclass -from utils.chat_utils import ContentCategory, category_qualifiers +from src.utils.chat_utils import ContentCategory, category_qualifiers @dataclass diff --git a/api/src/utils/session_manager.py b/api/src/utils/session_manager.py index 3dd96da..26bdfac 100644 --- a/api/src/utils/session_manager.py +++ b/api/src/utils/session_manager.py @@ -1,14 +1,14 @@ from dataclasses import dataclass from typing import Callable, Dict, List, Optional, cast -from services.firestore_sdk import ( +from src.services.firestore_sdk import ( Collection, DBManager, arrayRemove, arrayUnion, collections, ) -from utils.chat_utils import SessionChatMessage +from src.utils.chat_utils import SessionChatMessage @dataclass diff --git a/api/src/utils/waveform_utils.py b/api/src/utils/waveform_utils.py index df8c6ed..99fd824 100644 --- a/api/src/utils/waveform_utils.py +++ b/api/src/utils/waveform_utils.py @@ -3,7 +3,7 @@ from seewav import visualize -from services.storage import StorageManager +from src.services.storage import StorageManager class WaveformUtils: diff --git a/api/tests/__init__.py b/api/tests/__init__.py index 03938a2..f83e1fa 100644 --- a/api/tests/__init__.py +++ b/api/tests/__init__.py @@ -1,6 +1,6 @@ from dotenv import load_dotenv -from services.admin_sdk import init_admin_sdk +from src.services.admin_sdk import init_admin_sdk load_dotenv()