Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(website): add service Huggingface to website #3812

Merged
merged 2 commits into from
Dec 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/src/services/dbfs/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ This service can be used to:
- `endpoint`: Set the endpoint for backend.
- `token`: Databricks personal access token.

Refer to [`Builder`]'s public API docs for more information.
Refer to [`DbfsBuilder`]'s public API docs for more information.

## Examples

Expand Down
4 changes: 2 additions & 2 deletions core/src/services/huggingface/docs.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
This service will visit the [Huggingface API](https://huggingface.co/docs/huggingface_hub/package_reference/hf_api) to access the Huggingface File System.
Currently, we only support the `model` and `dataset` types of repositories, and operations are limited to reading and listing/stating.

Huggingface doesn't host official HTTP API docs. Detailed HTTP request API information can be found on the [Huggingface Hub](https://github.com/huggingface/huggingface_hub).
Huggingface doesn't host official HTTP API docs. Detailed HTTP request API information can be found on the [`huggingface_hub` Source Code](https://github.com/huggingface/huggingface_hub).

## Capabilities

Expand All @@ -27,7 +27,7 @@ This service can be used to:
- `root`: Set the work directory for backend.
- `token`: The token for accessing the repository.

Refer to [`Builder`]'s public API docs for more information.
Refer to [`HuggingfaceBuilder`]'s public API docs for more information.

## Examples

Expand Down
2 changes: 1 addition & 1 deletion core/src/services/swift/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ This service can be used to:
- `container`: Swift container.
- `token`: Swift personal access token.

Refer to [`Builder`]'s public API docs for more information.
Refer to [`SwiftBuilder`]'s public API docs for more information.

## Examples

Expand Down
76 changes: 76 additions & 0 deletions website/docs/services/huggingface.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
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>
Loading