title: Transcript Analysis
emoji: 📝
colorFrom: blue
colorTo: green
sdk: docker
app_port: 7860
pinned: false
ml-tech-assessment
Environment Setup
Using Conda (Recommended)
Install Conda if you haven't already:
Create and activate a new conda environment:
conda create -n ml-assessment python=3.12 conda activate ml-assessment
Installing Poetry and Dependencies
Install Poetry using pip:
pip install poetryInstall project dependencies:
poetry install
Environment Variables
- Create a
.envfile in the root directory of the project - Add the OpenAI API key and optional model:
OPENAI_API_KEY=your-openai-api-key
OPENAI_MODEL=gpt-4o-2024-08-06
Running Tests
To run the tests, make sure you have:
- Activated your virtual environment
- Installed all dependencies using Poetry
- Created and populated the
.envfile
Then run:
pytest
For more detailed test output:
pytest -v
For test coverage report:
pytest --cov
Running the API
Start the FastAPI application with:
poetry run uvicorn app.main:app --reload
If Poetry is not installed globally but dependencies are already installed in the local virtual environment, run:
./.venv/bin/uvicorn app.main:app --reload
Swagger documentation is available at:
http://127.0.0.1:8000/docs
The Gradio frontend is available at:
http://127.0.0.1:8000/
Analyze one transcript:
curl -G "http://127.0.0.1:8000/analyses" \
--data-urlencode "transcript=Discuss the launch plan and assign next steps."
Retrieve a stored analysis:
curl "http://127.0.0.1:8000/analyses/<analysis-id>"
Analyze multiple transcripts concurrently:
curl -X POST "http://127.0.0.1:8000/analyses/batch" \
-H "Content-Type: application/json" \
-d '{"transcripts":["Discuss launch risks.","Review onboarding plan."]}'
Analysis results are stored in memory, so they reset when the API process restarts.
OpenAI Adapter Integration Test
The live OpenAI adapter test is skipped by default so local test runs do not require network access or credentials. To run it explicitly:
RUN_OPENAI_INTEGRATION_TESTS=1 poetry run pytest tests/adapters/test_openai.py