Skip to content

Commit 634945e

Browse files
committed
minor, put link to code
1 parent d6e57be commit 634945e

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

  • content/workshops/ai/translate-hugging-face

content/workshops/ai/translate-hugging-face/_index.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ Crowd-sourced resources:
5252

5353
https://huggingface.co/spaces/gradio-tests/english_to_spanish
5454

55+
## Try it!
56+
5557
<iframe
5658
src="https://gradio-tests-english-to-spanish.hf.space"
5759
frameborder="0"
@@ -79,3 +81,27 @@ Select Javascript.
7981

8082

8183
{{% /section %}}
84+
85+
---
86+
87+
### Javascript call to the API
88+
89+
```js
90+
$ cat index.js
91+
import { client } from "@gradio/client";
92+
93+
const app = await client("https://gradio-tests-english-to-spanish.hf.space/");
94+
const result = await app.predict("/predict", [
95+
"Howdy!", // string in 'text' Textbox component
96+
]);
97+
98+
console.log(result.data);
99+
```
100+
101+
```bash
102+
$ npm i -D @gradio/client
103+
$ node index.js
104+
[ '¡Hola!' ]
105+
```
106+
107+
See code here: https://github.com/grizzlyhacks/workshop-hugging-face-translate

0 commit comments

Comments
 (0)