This project develops a web application that enables users to search through UCSD courses using semantic search capabilities. It leverages a weighted cosine similarity algorithm to compare the query embeddings with the embeddings of course titles and descriptions, ensuring relevant search results. The core of this semantic search functionality is powered by the FlagModel BAAI/bge-small-en-v1.5 embedding model. For more details on the embedding model, visit Hugging Face's model repository.
If you would just like to visit the website: http://ucsd-course-search.westus2.azurecontainer.io:8000/
To run the Jupyter notebooks included in this project, follow these steps:
- Create a Virtual Environment:
python -m venv venv
- Activate the Virtual Enviroment
venv/Scripts/activate
- Install Required Dependencies:
pip install -r requirements.txt
- Run the Desired Notebook
- Docker Desktop must be installed and running.
- You must have a Docker Hub account
- Azure CLI should be installed.
- You must have an Azure account and be able to log in.
Execute the following commands to build and publish the Docker image: (replace names with your own)
-
Login to Docker Hub and create a Repository
-
Build the Docker Image:
docker build -t <your-docker-image-name> . # example docker build -t ucsdcoursesearch-docker .
-
Tag the Docker Image:
docker tag <your-docker-image-name>:<your-dockerhub-username>/<your-repository-name>:<target-tag> # example docker tag ucsdcoursesearch-docker:latest mfrankne/ucsdcoursesearch:latest
-
Push the Docker Image to a Registry:
docker push <your-dockerhub-username>/<your-repository-name>:<target-tag> # example docker push mfrankne/ucsdcoursesearch:latest
-
Login to Azure:
az login
Follow the prompts for credentials.
To deploy the web application on Azure with a (public) Docker image, use the following command:
az container create --resource-group <your-resource-group-name> --name <your-container-instance-name> --image your-dockerhub-username>/<your-repository-name>:<target-tag> --cpu 4 --memory 4 --dns-name-label <website-url-tag> --ports <port-number>
# example
az container create --resource-group ucs-resource-group --name min-ucs-app-instance --image mfrankne/ucsdcoursesearch:latest --cpu 4 --memory 4 --dns-name-label ucsd-course-search --ports 8000
The website will be accessible at http://ucsd-course-search.eastus.azurecontainer.io:8000/
.
- To Check the Container State:
az container show --resource-<your-resource-group-name> --name <your-container-instance-name> --query containers[0].instanceView.currentState.state # example az container show --resource-group ucs-resource-group --name min-ucs-app-instance --query containers[0].instanceView.currentState.state
- To View Container Events:
az container show --resource-<your-resource-group-name> --name <your-container-instance-name> --query instanceView.events # example az container show --resource-group ucs-resource-group --name min-ucs-app-instance --query instanceView.events
- To Access Container Logs:
az container logs --resource-<your-resource-group-name> --name <your-container-instance-name> # example az container logs --resource-group ucs-resource-group --name min-ucs-app-instance