hugging_face_client/
lib.rs

1//! ### Create Client
2//!
3//! ```rust
4//! use std::time::Duration;
5//! use hugging_face_client::client::{Client, ClientOption};
6//!
7//! #[tokio::main(flavor = "current_thread")]
8//! async fn main() {
9//!   let access_token = std::env::var("HUGGING_FACE_TOKEN").unwrap();
10//!   let access_proxy = std::env::var("HUGGING_FACE_PROXY").unwrap();
11//!   let option = ClientOption::new(access_token)
12//!     .proxy(access_proxy)
13//!     .timeout(Duration::from_secs(5));
14//!   let client = Client::new(option).unwrap();
15//! }
16//! ```
17//!
18//! ### Get Model
19//! ```rust
20//! use hugging_face_client::api::GetModelReq;
21//! use hugging_face_client::client::{Client, ClientOption};
22//!
23//! #[tokio::main(flavor = "current_thread")]
24//! async fn main() {
25//!   let option = ClientOption::new("HUGGING_FACE_TOKEN");
26//!   let client = Client::new(option).unwrap();
27//!
28//!   // get model
29//!   let req = GetModelReq::new("microsoft/bitnet-b1.58-2B-4T");
30//!   let res = client.get_model(req).await.unwrap();
31//!   println!("{:#?}", res);
32//! }
33//! // Model { _id: "67fddfa9a7fe1f21ec1d3026", id: "microsoft/bitnet-b1.58-2B-4T", model_id: None ... }
34//! ```
35//! **More usage examples, can be seen [hugging-face-client/examples](https://github.com/dlzht/hugging-face-client/tree/main/examples)**
36
37#![feature(assert_matches)]
38
39pub mod api;
40pub mod client;
41pub mod errors;
42
43mod arxiv;
44mod collection;
45mod config;
46mod dataset;
47mod metric;
48mod model;
49mod paginamtion;
50mod provider;
51mod repo;
52mod runtime;
53mod sibling;
54mod sort;
55mod space;
56mod tag;
57mod user;
58
59pub use repo::RepoType;