-
Notifications
You must be signed in to change notification settings - Fork 473
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add service huggingface to website
- Loading branch information
Showing
2 changed files
with
76 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
--- | ||
title: Hugging Face | ||
--- | ||
|
||
[Hugging Face](https://huggingface.co/docs/huggingface_hub/main/en/package_reference/hf_api#huggingface_hub.HfApi) services support. | ||
|
||
import Docs from '../../../core/src/services/huggingface/docs.md' | ||
|
||
<Docs components={props.components} /> | ||
|
||
### Via Config | ||
|
||
import Tabs from '@theme/Tabs'; | ||
import TabItem from '@theme/TabItem'; | ||
|
||
<Tabs> | ||
<TabItem value="rust" label="Rust" default> | ||
|
||
```rust | ||
use anyhow::Result; | ||
use opendal::Operator; | ||
use opendal::Scheme; | ||
use std::collections::HashMap; | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<()> { | ||
let mut map = HashMap::new(); | ||
map.insert("repo_type".to_string(), "dataset".to_string()); | ||
map.insert("repo_id".to_string(), "databricks/databricks-dolly-15k".to_string()); | ||
map.insert("revision".to_string(), "main".to_string()); | ||
map.insert("root".to_string(), "/path/to/dir".to_string()); | ||
map.insert("token".to_string(), "access_token".to_string()); | ||
|
||
let op: Operator = Operator::via_map(Scheme::Huggingface, map)?; | ||
Ok(()) | ||
} | ||
``` | ||
|
||
</TabItem> | ||
<TabItem value="node.js" label="Node.js"> | ||
|
||
```javascript | ||
import { Operator } from "opendal"; | ||
|
||
async function main() { | ||
# Use `huggingface` or `hf` for scheme name | ||
const op = new Operator("huggingface", { | ||
repo_type: "dataset", | ||
repo_id: "databricks/databricks-dolly-15k", | ||
revision: "main", | ||
root: "/path/to/dir", | ||
token: "access_token", | ||
}); | ||
} | ||
``` | ||
|
||
</TabItem> | ||
<TabItem value="python" label="Python"> | ||
|
||
```python | ||
import opendal | ||
|
||
# Use `huggingface` or `hf` for scheme name | ||
op = opendal.Operator("huggingface", | ||
repo_type="dataset", | ||
repo_id="databricks/databricks-dolly-15k", | ||
revision="main", | ||
root: "/path/to/dir", | ||
token: "access_token", | ||
) | ||
``` | ||
|
||
</TabItem> | ||
</Tabs> |