Open
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR finalizes the deployment of our FastAPI sentiment analysis service on Render and optimizes the model for reduced memory usage.
- Updated dependencies by adding gunicorn and uvicorn to the requirements file
- Switched the model and tokenizer to a more efficient model, updated label mappings, and improved documentation for deployment on Render
- Adjusted the uvicorn command to dynamically bind to the provided PORT environment variable
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| api/requirements.txt | Added required dependencies for deployment |
| api/app.py | Updated model, label mapping, and port binding logic |
Comments suppressed due to low confidence (2)
api/app.py:41
- [nitpick] Update the label mapping comment to accurately reflect that the model now uses a binary classification for sentiment analysis.
#LABEL_0 -> negative, LABEL_1 -> neutral, LABEL_2 -> positive
api/app.py:163
- Ensure that the os module is imported at the beginning of the file to support the use of os.environ.
port = int(os.environ.get("PORT", 8000)) # fallback for local testing
NirathH
approved these changes
May 16, 2025
Collaborator
NirathH
left a comment
There was a problem hiding this comment.
This looks good! I see you switched out the sentiment model and updated the label mappings. Testing the logic and everything works as expected!
APPROVED !
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR finalizes deployment of our sentiment analysis FastAPI service to Render.
The live API is now hosted at: https://fitcheck-sentiment-analysis.onrender.com/
if this link does not work (model can spin out as it is the free tier) I can start it back up again as well
Changes Made
Render Deployment
buildCommandandstartCommandto align with the project structure (api/app.py).SUPABASE_URL,SUPABASE_KEY.Model Optimization
cardiffnlp/twitter-roberta-base-sentimentmodel with a smaller, more efficient alternative:distilbert-base-uncased-finetuned-sst-2-english.positive/negative) to match new model output.Dynamic Port Binding
uvicorncommand to use the environment-provided$PORT, as required by Render for port detection.This image doesnt show any real analysis as there is being no data sent to the model, it is just the model up and running!

