Hugging Face AI Translator Workshop

ITEC 3870 Software Development II,
Cengiz Gunay

(License: CC BY-SA 4.0)

Prev - Artificial Intelligence, Next - Chapters

What is Hugging Face?

One stop shop for all AI tasks simplified: https://huggingface.co

Create an account now!

Crowd-sourced resources:

  • Models: AI models ready to download and use.
  • Datasets: Download training/testing datasets for building models.
  • Spaces: Cloud-hosted AI apps, ready to use.

A English-to-Spanish Translator App on HF

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

Try it!

Use this app from a new Python program!

Click on “Use via API” to get Python code.

Or create a new Javascript program!

Select Javascript.

Javascript call to the API

$ cat index.js 
import { client } from "@gradio/client";

const app = await client("https://gradio-tests-english-to-spanish.hf.space/");
const result = await app.predict("/predict", [
                                "Howdy!", // string  in 'text' Textbox component
        ]);

console.log(result.data);
$ npm i -D @gradio/client
$ node index.js 
[ '¡Hola!' ]

See code here: https://github.com/grizzlyhacks/workshop-hugging-face-translate

Home