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

Session Close when called HuggingFace Client #411

Merged
merged 3 commits into from
Jan 5, 2023

Conversation

nil-andreu
Copy link
Contributor

No description provided.

@@ -46,4 +46,6 @@ async def post(self, input: str) -> Any:
# Get the response from the API call
inference = await response.json()

await session.close()
Copy link
Collaborator

@andreaskoepf andreaskoepf Jan 5, 2023

Choose a reason for hiding this comment

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

Could you please use a async with statement for the session (the session will then be closed automatically) so that the client is also closed in case of an exception?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure thanks! Done

Copy link
Collaborator

@andreaskoepf andreaskoepf left a comment

Choose a reason for hiding this comment

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

please use async with ...

Copy link
Collaborator

@andreaskoepf andreaskoepf left a comment

Choose a reason for hiding this comment

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

thanks for the super-quick update!

@andreaskoepf andreaskoepf merged commit 739c073 into LAION-AI:main Jan 5, 2023
@nil-andreu
Copy link
Contributor Author

thanks for the super-quick update!

Cheers! Thanks for the feedback!

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