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 get_model_req = GetModelReq::new("microsoft/bitnet-b1.58-2B-4T");
30//! let res = client.get_model(get_model_req).await?;
31//! println!("{:#?}", res);
32//! Ok(())
33//! }
34//! // Model { _id: "67fddfa9a7fe1f21ec1d3026", id: "microsoft/bitnet-b1.58-2B-4T", model_id: None ... }
35//! ```
36//! **More usage examples, can be seen [hugging-face-client/examples](https://github.com/dlzht/hugging-face-client/tree/main/examples)**
37
38#![feature(assert_matches)]
39
40pub mod api;
41pub mod client;
42pub mod errors;
43
44mod config;
45mod model;
46mod repo;
47mod sibling;
48mod sort;
49mod space;
50mod tag;
51
52pub use repo::RepoType;