Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recommender.py for FastAPI #100

Merged
merged 14 commits into from
Sep 1, 2023
Merged

Recommender.py for FastAPI #100

merged 14 commits into from
Sep 1, 2023

Conversation

jpjon
Copy link
Contributor

@jpjon jpjon commented Aug 30, 2023

Describe your changes

Created the .py file for the recommender that FastAPI will reference to.

Issue number

#99
Closes #99

Checklist before requesting a review

  • Performed a self-review of my code
  • Formatted my code with pkgmt format

📚 Documentation preview 📚: https://ploomber-sql--100.org.readthedocs.build/en/100/

@jpjon
Copy link
Contributor Author

jpjon commented Aug 30, 2023

Hi @lfunderburk

Can you take a look at what I have so far? My main concern regards my comment on how we would connect to the S3 Bucket using Lambda.

Besides that, I think the main get_recommendation function is of viable use for FastAPI.

@jpjon jpjon marked this pull request as ready for review August 31, 2023 19:42
@jpjon
Copy link
Contributor Author

jpjon commented Aug 31, 2023

Please navigate to the /recommendations folder and run uvicorn app:app --reload to launch the API.

Go to http://127.0.0.1:8000/docs#/default in your browser to test out the API with a movie. I used the movie "Barbie" and received the expected output.

@lfunderburk
Copy link
Contributor

lfunderburk commented Sep 1, 2023

Hi @jpjon

Did a bit of code clean up, type checking, pydantic modelling and added some testing

To execute tests

cd sql/mini-projects/movie-rec-system
pytest

From the Docker container we don't want to specify the path, we should be running things from the project's root directory (in this case sql/mini-projects/movie-rec-system)

Please execute the app as follows

 uvicorn movie_rec_system.app.app:app --reload

Visit

http://127.0.0.1:8000/docs

Copy link
Contributor

@lfunderburk lfunderburk left a comment

Choose a reason for hiding this comment

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

To do:

  1. Run the tests, there are one or two warnings. See if you can fix them
  2. Add a test under test/test_app.py to check that a given movie is returning the desired result
  3. Think of other ways the user might interact with the api - does it make sense to add another entry point?

@jpjon
Copy link
Contributor Author

jpjon commented Sep 1, 2023

Copy link
Contributor

@lfunderburk lfunderburk left a comment

Choose a reason for hiding this comment

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

Test coverage passes with new upgrades to pyproject.toml and app.py

Awesome!

@lfunderburk lfunderburk merged commit 6f82c60 into main Sep 1, 2023
2 checks passed
@lfunderburk lfunderburk deleted the recommender.py branch September 1, 2023 22:18
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.

Create .py script for recommender system
2 participants