Struct hf_hub::api::sync::ApiBuilder
source · pub struct ApiBuilder { /* private fields */ }
Expand description
Helper to create Api
with all the options.
Implementations§
source§impl ApiBuilder
impl ApiBuilder
sourcepub fn new() -> Self
pub fn new() -> Self
Default api builder
use hf_hub::api::sync::ApiBuilder;
let api = ApiBuilder::new().build().unwrap();
sourcepub fn from_cache(cache: Cache) -> Self
pub fn from_cache(cache: Cache) -> Self
From a given cache
use hf_hub::{api::sync::ApiBuilder, Cache};
let path = std::path::PathBuf::from("/tmp");
let cache = Cache::new(path);
let api = ApiBuilder::from_cache(cache).build().unwrap();
sourcepub fn with_progress(self, progress: bool) -> Self
pub fn with_progress(self, progress: bool) -> Self
Wether to show a progressbar
sourcepub fn with_cache_dir(self, cache_dir: PathBuf) -> Self
pub fn with_cache_dir(self, cache_dir: PathBuf) -> Self
Changes the location of the cache directory. Defaults is ~/.cache/huggingface/
.
sourcepub fn with_token(self, token: Option<String>) -> Self
pub fn with_token(self, token: Option<String>) -> Self
Sets the token to be used in the API
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for ApiBuilder
impl Send for ApiBuilder
impl Sync for ApiBuilder
impl Unpin for ApiBuilder
impl UnwindSafe for ApiBuilder
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