Skip to content

Commit b8b086f

Browse files
authored
Api env (#17)
* Suggest removing the docker, and instead installing the CLI. * Putting back the profile. * Getting the API from environment (to catch other things like `HF_HOME`).
1 parent 9a9fc11 commit b8b086f

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ async fn main() {
197197
let stop_sender_clone = stop_sender.clone();
198198
// get HF token
199199
let token_env_key = "HF_TOKEN".to_string();
200-
let cache = hf_hub::Cache::default();
200+
let cache = hf_hub::Cache::from_env();
201201
let hf_token = match std::env::var(token_env_key).ok() {
202202
Some(token) => Some(token),
203203
None => cache.token(),

src/requests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ impl ConversationTextRequestGenerator {
547547
filename: String,
548548
hf_token: Option<String>,
549549
) -> anyhow::Result<PathBuf> {
550-
let api = ApiBuilder::new().with_token(hf_token).build()?;
550+
let api = ApiBuilder::from_env().with_token(hf_token).build()?;
551551
let repo = api.dataset(repo_name);
552552
let dataset = repo.get(&filename)?;
553553
Ok(dataset)

0 commit comments

Comments
 (0)