Skip to content

Conversation

qtuantruong
Copy link
Member

@qtuantruong qtuantruong commented Oct 30, 2023

Description

Adding a simple method to serve model with launching a standalone web service. Good enough for model testing or creating a demo application.

Related Issues

Checklist:

  • I have added tests.
  • I have updated the documentation accordingly.
  • I have updated README.md (if you are adding a new model).
  • I have updated examples/README.md (if you are adding a new example).
  • I have updated datasets/README.md (if you are adding a new dataset).

@qtuantruong qtuantruong requested a review from darrylong October 30, 2023 22:40
README.md Outdated
```
Here you go, your model service is now ready. Let's get `top-5` item recommendations for the user `"63"`:
```bash
$ curl http://127.0.0.1:8080/recommend \
Copy link
Member

Choose a reason for hiding this comment

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

Please consider using GET request instead of using POST for this purpose. We can also use request query such as ?uid=63&k=5 in replacement of request body.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the comment. The reason we put data in the json body is because uid is raw string ID of user in the original data, not the integer index. We just try to avoid any encoding issue for cases where uid contains special characters/white spaces. With that said, those cases are rare and we can consider switching to GET request.

Copy link
Member Author

Choose a reason for hiding this comment

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

@darrylong @hieuddo what do you guys think?

Copy link
Member

Choose a reason for hiding this comment

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

Cool. I think we can develop more user-friendly queries in the future. Is that the further goal, or only provide API?

Copy link
Member

Choose a reason for hiding this comment

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

@tqtg Since we are obtaining recommendations, I think GET seems more appropriate just not to complicate the developers. I think string uid should work as well in GET, unless there are unique formats?

Copy link
Member Author

Choose a reason for hiding this comment

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

I've changed to GET request. We can change to POST later if we face real encoding issue.

Copy link
Member

@lthoang lthoang left a comment

Choose a reason for hiding this comment

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

LGTM

@qtuantruong qtuantruong merged commit e792f22 into PreferredAI:master Nov 4, 2023
@qtuantruong qtuantruong deleted the simple-serving branch November 4, 2023 22:49
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.

4 participants