pub struct Client { /* private fields */ }Expand description
Async client for Hugging Face Hub
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(option: ClientOption) -> Result<Self>
pub fn new(option: ClientOption) -> Result<Self>
Create Client instance with ClientOption
use hugging_face_client::client::Client;
use hugging_face_client::client::ClientOption;
use std::time::Duration;
fn main() {
let option = ClientOption::new("HUGGING_FACE_TOKEN")
.timeout(Duration::from_secs(5));
let client = Client::new(option);
}Sourcepub async fn get_models(&self, req: GetModelsReq<'_>) -> Result<GetModelsRes>
pub async fn get_models(&self, req: GetModelsReq<'_>) -> Result<GetModelsRes>
Endpoint: GET /api/models
Get information from all models in the Hub
Sourcepub async fn get_model(&self, req: GetModelReq<'_>) -> Result<GetModelRes>
pub async fn get_model(&self, req: GetModelReq<'_>) -> Result<GetModelRes>
Endpoint: GET /api/models/{repo_id}
Endpoint: GET /api/models/{repo_id}/revision/{revision}
Get all information for a specific model
Sourcepub async fn create_repo(&self, req: CreateRepoReq<'_>) -> Result<CreateRepoRes>
pub async fn create_repo(&self, req: CreateRepoReq<'_>) -> Result<CreateRepoRes>
Endpoint: POST /api/repos/create
Create a repository, model repo by default.
Sourcepub async fn delete_repo(&self, req: DeleteRepoReq<'_>) -> Result<()>
pub async fn delete_repo(&self, req: DeleteRepoReq<'_>) -> Result<()>
Endpoint: DELETE /api/repos/delete
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more