Skip to content

Ml deployment#33

Open
BaljinderHothi wants to merge 4 commits intomainfrom
ML-deployment
Open

Ml deployment#33
BaljinderHothi wants to merge 4 commits intomainfrom
ML-deployment

Conversation

@BaljinderHothi
Copy link
Owner

@BaljinderHothi BaljinderHothi commented May 16, 2025

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

    • Configured buildCommand and startCommand to align with the project structure (api/app.py).
    • Defined essential environment variables: SUPABASE_URL, SUPABASE_KEY.
  • Model Optimization

    • Replaced large cardiffnlp/twitter-roberta-base-sentiment model with a smaller, more efficient alternative:
      distilbert-base-uncased-finetuned-sst-2-english.
    • Updated sentiment label mapping (binary classification: positive/negative) to match new model output.
    • Significantly reduced memory usage to stay under Render's 512MiB free tier limit.
  • Dynamic Port Binding

    • Adjusted the uvicorn command 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!
image
image

@NirathH NirathH requested a review from Copilot May 16, 2025 04:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 NirathH self-requested a review May 16, 2025 05:00
Copy link
Collaborator

@NirathH NirathH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments