Hub documentation
Widgets
Widgets
์์ ฏ์ด๋ ๋ฌด์์ธ๊ฐ์?
๋ง์ ๋ชจ๋ธ ์ ์ฅ์์๋ ๋ธ๋ผ์ฐ์ ์์ ๋๊ตฌ๋ ์ถ๋ก ์ ์ง์ ์คํํ ์ ์๋ ์์ ฏ์ด ์์ต๋๋ค. ์ด๋ฌํ ์์ ฏ์ Inference Providers์ ์ํด ๊ตฌ๋๋๋ฉฐ, ์๋ฒ๋ฆฌ์ค ์ถ๋ก ํํธ๋์ ์ง์์ ๋ฐ์ ๊ฐ๋ฐ์์๊ฒ ์๋ฐฑ ๊ฐ์ ๊ธฐ๊ณ ํ์ต ๋ชจ๋ธ์ ๋ํ ๋จ์ํ๋๊ณ ํตํฉ๋ ์ ๊ทผ์ ์ ๊ณตํฉ๋๋ค.
ํ์ฌ ์ธ๊ธฐ ์๋ ๋ชจ๋ธ์ ์์๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
- DeepSeek V3 - ์ต์ฒจ๋จ ์คํ ์จ์ดํธ ๋ํํ ๋ชจ๋ธ
- Flux Kontext - ์ด๋ฏธ์ง ํธ์ง์ ์ํ ์คํ ์จ์ดํธ ํธ๋์คํฌ๋จธ ๋ชจ๋ธ
- Falconsai์ NSFW Detection - ์ด๋ฏธ์ง ์ฝํ ์ธ ๋ชจ๋๋ ์ด์
- ResembleAI์ Chatterbox - ํ๋ก๋์ ๊ธ ์คํ์์ค ํ ์คํธ-์์ฑ ๋ณํ ๋ชจ๋ธ.
๋ชจ๋ธ ํ์ด์ง์์ ๋ ๋ง์ ๋ชจ๋ธ๊ณผ ์์ ฏ์ ํ์ํ๊ฑฐ๋, Inference Playground์์ ์ธํฐ๋ํฐ๋ธ๋ก ์ฌ์ฉํด ๋ณผ ์ ์์ต๋๋ค.
์์ ฏ ํ์ฑํ
๋ชจ๋ธ์ด ์ต์ ํ๋์ Inference Provider์ ์ํด ํธ์คํ ๋๋ ๊ฒฝ์ฐ ์์ ฏ์ด ํ์๋๋ฉฐ, ์ด๋ฅผ ํตํด ๋ชจ๋ธ ์ถ๋ก ์ ์ต์ ์ ์ฑ๋ฅ๊ณผ ์ ๋ขฐ์ฑ์ ๋ณด์ฅํฉ๋๋ค. Provider๋ ์์จ์ ์ผ๋ก ๋ฐฐํฌํ ๋ชจ๋ธ์ ์ ํํ๊ณ ์ ์ดํฉ๋๋ค.
ํ์๋๋ ์์ ฏ์ ์ ํ(ํ
์คํธ์์ ์ด๋ฏธ์ง, ์๋ ์์ฑ ์ธ์ ๋ฑ)์ Hub๊ฐ ๋ชจ๋ ๋ชจ๋ธ์ ๋ํด ์๋์ผ๋ก ๊ณ์ฐํ๋ ค๊ณ ํ๋ ํน์ ํ๊ทธ์ธ ๋ชจ๋ธ์ pipeline_tag์์ ์ถ๋ก ๋ฉ๋๋ค. ์ ์ผํ ์์ธ๋ conversational ์์ ฏ์ผ๋ก, pipeline_tag๊ฐ text-generation ๋๋ image-text-to-text์ธ ๋ชจ๋ ๋ชจ๋ธ์ ํ์๋ฉ๋๋ค. ๋จ์์ฑ์ ์ํด ๋ชจ๋ธ๋น ํ๋์ ์์ ฏ๋ง ๋
ธ์ถํ๋๋ก ์ ํํ์ต๋๋ค.
transformers์ ๊ฐ์ ์ผ๋ถ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๊ฒฝ์ฐ, ๊ตฌ์ฑ ํ์ผ(config.json)์ ๊ธฐ๋ฐ์ผ๋ก ๋ชจ๋ธ ์ ํ์ ์๋์ผ๋ก ์ถ๋ก ํ ์ ์์ต๋๋ค. ์ํคํ
์ฒ๊ฐ ์ ํ์ ๊ฒฐ์ ํ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด, AutoModelForTokenClassification๋ token-classification์ ํด๋นํฉ๋๋ค. ์ด ๋ถ๋ถ์ ๊ด์ฌ์ด ์๋ค๋ฉด ์ด gist์์ ์์ฌ ์ฝ๋๋ฅผ ํ์ธํ ์ ์์ต๋๋ค.
๋๋ถ๋ถ์ ๋ค๋ฅธ ์ฌ์ฉ ์ฌ๋ก์์๋ ๋ชจ๋ธ ํ๊ทธ๋ฅผ ์ฌ์ฉํ์ฌ ๋ชจ๋ธ ์์
์ ํ์ ๊ฒฐ์ ํฉ๋๋ค. ์๋ฅผ ๋ค์ด, ๋ชจ๋ธ ์นด๋ ๋ฉํ๋ฐ์ดํฐ์ tag: text-classification๊ฐ ์๋ ๊ฒฝ์ฐ, ์ถ๋ก ๋ pipeline_tag๋ text-classification๊ฐ ๋ฉ๋๋ค.
๋ชจ๋ธ ์นด๋ ๋ฉํ๋ฐ์ดํฐ์์ pipeline_tag: xxx๋ฅผ ์ฌ์ฉํ์ฌ ํ์ดํ๋ผ์ธ ์ ํ์ ์๋์ผ๋ก ๋ฎ์ด์ธ ์ ์์ต๋๋ค. (๋ฉํ๋ฐ์ดํฐ GUI ํธ์ง๊ธฐ๋ฅผ ์ฌ์ฉํ์ฌ ์ด ์์
์ ์ํํ ์๋ ์์ต๋๋ค).
๋ชจ๋ธ ์์ ฏ์ ์์ ์ ๋ ฅ์ ์ด๋ป๊ฒ ์ ์ดํ ์ ์๋์?
๋ชจ๋ธ ์นด๋์ ๋ฉํ๋ฐ์ดํฐ ์น์ ์์ ์์ ฏ ์ ๋ ฅ์ ์ง์ ํ ์ ์์ต๋๋ค:
widget:
- text: "This new restaurant has amazing food and great service!"
example_title: "Positive Review"
- text: "I'm really disappointed with this product. Poor quality and overpriced."
example_title: "Negative Review"
- text: "The weather is nice today."
example_title: "Neutral Statement"์ฌ๋ฌ ๊ฐ์ ์์ ์
๋ ฅ์ ์ ๊ณตํ ์ ์์ต๋๋ค. ์์ ฏ์ ์์ ๋๋กญ๋ค์ด ๋ฉ๋ด์์ Example 1, Example 2 ๋ฑ์ผ๋ก ํ์๋ฉ๋๋ค. ์ ํ์ ์ผ๋ก example_title๋ ํจ๊ป ์ ๊ณตํ ์ ์์ต๋๋ค.

widget:
- text: "Is this review positive or negative? Review: Best cast iron skillet you will ever buy."
example_title: "Sentiment analysis"
- text: "Barack Obama nominated Hilary Clinton as his secretary of state on Monday. He chose her because she had ..."
example_title: "Coreference resolution"
- text: "On a shelf, there are five books: a gray book, a red book, a purple book, a blue book, and a black book ..."
example_title: "Logic puzzles"
- text: "The two men running to become New York City's next mayor will face off in their first debate Wednesday night ..."
example_title: "Reading comprehension"๋ํ, ๋ชจ๋ธ ์นด๋ ๋ฉํ๋ฐ์ดํฐ์ ํ
์คํธ๊ฐ ์๋ ์์ ์
๋ ฅ์ ์ง์ ํ ์ ์์ต๋๋ค. ๋ชจ๋ ์์ ฏ ์ ํ์ ๋ํ ์ํ ์
๋ ฅ ํ์์ ์ ์ฒด ๋ชฉ๋ก์ ์ฌ๊ธฐ๋ฅผ ์ฐธ์กฐํ์ธ์. ๋น์ & ์ค๋์ค ์์ ฏ ์ ํ์ ๊ฒฝ์ฐ, text ๋์ src๋ก ์์ ์
๋ ฅ์ ์ ๊ณตํ์ธ์.
์๋ฅผ ๋ค์ด, ์๋ ์์ฑ ์ธ์ ์์ ์ ์ํด ์ฌ์ฉ์๊ฐ ๋ ๊ฐ์ ์ํ ์ค๋์ค ํ์ผ ์ค ํ๋๋ฅผ ์ ํํ ์ ์๋๋ก ํ๋ ค๋ฉด:
widget:
- src: https://example.org/somewhere/speech_samples/sample1.flac
example_title: Speech sample 1
- src: https://example.org/somewhere/speech_samples/sample2.flac
example_title: Speech sample 2๋ชจ๋ธ ์ ์ฅ์์ ์์ ํ์ผ์ ํฌํจํ ์๋ ์์ผ๋ฉฐ, ์ด๋ฅผ ๋ค์๊ณผ ๊ฐ์ด ์ฌ์ฉํ ์ ์์ต๋๋ค:
widget:
- src: https://huggingface.co/username/model_repo/resolve/main/sample1.flac
example_title: Custom Speech Sample 1๋ ํธ๋ฆฌํ ์ ์, ํด๋น ํ์ผ์ด ๋ชจ๋ธ ์ ์ฅ์์ ์๋ ๊ฒฝ์ฐ ์ ์ฅ์ ๋ด ํ์ผ๋ช ๋๋ ํ์ผ ๊ฒฝ๋ก๋ฅผ ๊ทธ๋๋ก ์ฌ์ฉํ ์ ์๋ค๋ ๊ฒ์ ๋๋ค:
widget:
- src: sample1.flac
example_title: Custom Speech Sample 1๋๋ ์ ์ฅ์ ์์ ์ค์ฒฉ๋์ด ์๋ ๊ฒฝ์ฐ:
widget:
- src: nested/directory/sample1.flac์ผ๋ถ ์ธ์ด์ ๋๋ถ๋ถ์ ์์ ฏ ์ ํ์ ๋ํ ์์ ์ ๋ ฅ์ default-widget-inputs.ts ํ์ผ์ ์ ๊ณตํฉ๋๋ค. ์ผ๋ถ ์์๊ฐ ๋๋ฝ๋ ๊ฒฝ์ฐ, ์ปค๋ฎค๋ํฐ์์ ์ถ๊ฐ๋ฅผ ์ํ PR์ ํ์ํฉ๋๋ค!
์์ ์ถ๋ ฅ
์์ ์
๋ ฅ์ ํ์ฅ์ผ๋ก, ๊ฐ ์์ ฏ ์์์์ output ์์ฑ์ ํด๋น ๋ชจ๋ธ์ ์ถ๋ ฅ์ ์ ํ์ ์ผ๋ก ์ง์ ์ค๋ช
ํ ์ ์์ต๋๋ค.
๋ชจ๋ธ์ด ์์ง Inference Providers์ ์ํด ์ง์๋์ง ์๋ ๊ฒฝ์ฐ ์ ์ฉํ๋ฉฐ, ์ด ๊ฒฝ์ฐ์๋ ๋ชจ๋ธ ํ์ด์ง์์ ๋ชจ๋ธ์ด ์ด๋ป๊ฒ ์๋ํ๋์ง ๋ฐ ์ด๋ค ๊ฒฐ๊ณผ๋ฅผ ์ ๊ณตํ๋์ง ๋ณด์ฌ์ค ์ ์์ต๋๋ค.
์๋ฅผ ๋ค์ด, automatic-speech-recognition ๋ชจ๋ธ์ ๊ฒฝ์ฐ:
widget:
- src: sample1.flac
output:
text: "Hello my name is Julien"

output ์์ฑ์ Inference Providers์ ์ถ๋ ฅ ํ์์ ๋ํ๋ด๋ YAML ์ฌ์ ์ด์ด์ผ ํฉ๋๋ค.
ํ ์คํธ๋ฅผ ์ถ๋ ฅํ๋ ๋ชจ๋ธ์ ๊ฒฝ์ฐ, ์์ ์์๋ฅผ ์ฐธ์กฐํ์ธ์.
๋ ์ด๋ธ์ ์ถ๋ ฅํ๋ ๋ชจ๋ธ(์: text-classification ๋ชจ๋ธ)์ ๊ฒฝ์ฐ, ์ถ๋ ฅ์ ๋ค์๊ณผ ๊ฐ์ ํํ์ฌ์ผ ํฉ๋๋ค:
widget:
- text: "I liked this movie"
output:
- label: POSITIVE
score: 0.8
- label: NEGATIVE
score: 0.2

๋ง์ง๋ง์ผ๋ก, ์ด๋ฏธ์ง, ์ค๋์ค ๋๋ ๊ธฐํ ์์ฐ ์ ํ์ ์ถ๋ ฅํ๋ ๋ชจ๋ธ์ ๊ฒฝ์ฐ, ์ถ๋ ฅ์๋ ์ ์ฅ์ ๋ด๋ถ์ ํ์ผ ์ด๋ฆ์ด๋ ๊ฒฝ๋ก ๋๋ ์๊ฒฉ URL์ ๊ฐ๋ฆฌํค๋ url ์์ฑ์ด ํฌํจ๋์ด์ผ ํฉ๋๋ค. ์๋ฅผ ๋ค์ด, ํ
์คํธ-์ด๋ฏธ์ง ๋ณํ ๋ชจ๋ธ์ ๊ฒฝ์ฐ:
widget:
- text: "picture of a futuristic tiger, artstation"
output:
url: images/tiger.jpg

Hugging Face UI์์ ์์ ์ถ๋ ฅ์ ํ์ํ ์๋ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด, ํ ์คํธ-์ด๋ฏธ์ง ๋ชจ๋ธ์ ๊ฒฝ์ฐ ๋ฉ์ง ์ด๋ฏธ์ง ์์ฑ ๊ฐค๋ฌ๋ฆฌ๋ฅผ ๋ณด์ฌ์ค ์ ์์ต๋๋ค.

์์ ฏ ์ฌ์ฉ ๊ฐ๋ฅ ์ฌ๋ถ ๋ฐ ์ ๊ณต์ ์ง์
๋ชจ๋ ๋ชจ๋ธ์ ์์ ฏ์ด ์ ๊ณต๋์ง๋ ์์ต๋๋ค. ์์ ฏ ์ฌ์ฉ ๊ฐ๋ฅ ์ฌ๋ถ๋ ๋ค์ ์ฌํญ์ ๋ฐ๋ผ ๋ฌ๋ผ์ง๋๋ค:
- ์์ ์ง์: ํด๋น ๋ชจ๋ธ์ ์์ ์ Inference Providers ๋คํธ์ํฌ์ ์ต์ ํ ๊ฐ์ ํ๋ก๋ฐ์ด๋์ ์ํด ์ง์๋์ด์ผ ํฉ๋๋ค
- ํ๋ก๋ฐ์ด๋ ๊ฐ์ฉ์ฑ: ํน์ ๋ชจ๋ธ์ ์๋นํ๋ ํ๋ก๋ฐ์ด๋๊ฐ ์ต์ ํ๋ ์ด์ ์์ด์ผ ํฉ๋๋ค
- ๋ชจ๋ธ ๊ตฌ์ฑ: ๋ชจ๋ธ์๋ ์ ์ ํ ๋ฉํ๋ฐ์ดํฐ์ ๊ตฌ์ฑ ํ์ผ์ด ์์ด์ผ ํฉ๋๋ค
์ง์๋๋ ์์ ์ ์ ์ฒด ๋ชฉ๋ก์ ๋ณด๋ ค๋ฉด ์ ์ฉ ๋ฌธ์ ํ์ด์ง๋ฅผ ํ์ธํ์ธ์.
๋ชจ๋ ํ๋ก๋ฐ์ด๋ ๋ชฉ๋ก๊ณผ ์ด๋ค์ด ์ง์ํ๋ ์์ ์ ์ด ๋ฌธ์ ํ์ด์ง์์ ํ์ธํ ์ ์์ต๋๋ค.
provider ์ง์์ด ์๋ ๋ชจ๋ธ์ ๊ฒฝ์ฐ์๋ ๋ชจ๋ธ ์นด๋์ ์์ ์ถ๋ ฅ์ ์ฌ์ฉํ์ฌ ๊ธฐ๋ฅ์ ๋ณด์ฌ์ค ์ ์์ต๋๋ค.
๋ชจ๋ธ ํ์ด์ง์์ Ask for provider support๋ฅผ ์ง์ ํด๋ฆญํ์ฌ, ์ปค๋ฎค๋ํฐ์ ๊ด์ฌ์ด ์ถฉ๋ถํ ๊ฒฝ์ฐ ํ๋ก๋ฐ์ด๋๊ฐ ํด๋น ๋ชจ๋ธ์ ์๋นํ๋๋ก ์ฅ๋ คํ ์๋ ์์ต๋๋ค.
Inference Playground๋ฅผ ํตํ ๋ชจ๋ธ ํ์
์ ํ๋ฆฌ์ผ์ด์ ์ ๋ชจ๋ธ์ ํตํฉํ๊ธฐ ์ ์ Inference Playground๋ฅผ ์ฌ์ฉํ์ฌ ์ธํฐ๋ํฐ๋ธํ๊ฒ ํ ์คํธํ ์ ์์ต๋๋ค. ์ด ํ๋ ์ด๊ทธ๋ผ์ด๋์์๋ ๋ค์์ ์ํํ ์ ์์ต๋๋ค:
- ์ปค์คํ ํ๋กฌํํธ๋ก ๋ค์ํ ์ฑํ ์์ฑ ๋ชจ๋ธ์ ํ ์คํธํด ๋ณด์ธ์
- ๋ค๋ฅธ ๋ชจ๋ธ ๊ฐ ์๋ต ๋น๊ต
- temperature, max tokens ๋ฑ ์ถ๋ก ๋งค๊ฐ๋ณ์๋ฅผ ์คํํด ๋ณด์ธ์
- ๊ตฌ์ฒด์ ์ธ ์ฌ์ฉ ์ฌ๋ก์ ๊ฐ์ฅ ์ ํฉํ ๋ชจ๋ธ์ ์ฐพ์๋ณด์ธ์
Playground๋ ์์ ฏ์ ๊ตฌ๋ํ๋ ๊ฒ๊ณผ ๋์ผํ Inference Providers ์ธํ๋ผ๋ฅผ ์ฌ์ฉํ๋ฏ๋ก, ๋ชจ๋ธ์ ์์ฒด ์ ํ๋ฆฌ์ผ์ด์ ์ ํตํฉํ ๋ ์ ์ฌํ ์ฑ๋ฅ๊ณผ ๊ธฐ๋ฅ์ ๊ธฐ๋ํ ์ ์์ต๋๋ค.
Update on GitHub