Gen-AI Developer Classroom notes 06/Mar/2025

Virtual environment

Assumption:

  • We are asked to work on a fastapi project to run the ml models.
  • This project requires fast api, pytorch and hugging face
  • What we would acheive
    • creating virtual environment
    • writing a python module
    • creating a jupyter notebook with virtual environment

Steps

  • Create a new folder
  • Now execute the following command
# Create a virtual environment and store everything in .venv
python -m venv .venv

Preview
Preview

  • Now activate the virtual environment
    • Windows .\.venv\Scripts\activate
      Preview
    • Mac or linux source .venv/bin/activate
  • Now install dependencies fastapi Refer Here
pip install "fastapi[standard]"
  • To make it easier to list out dependencies we list all of them in a file called as requirements.txt
pip freeze > requirements.txt

By continuous learner

enthusiastic technology learner

Leave a Reply

Discover more from Direct AI Powered By Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading