Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,21 +1,17 @@
|
|
1 |
pip install transformers gradio sentencepiece
|
2 |
pip install transformers[sentencepiece]
|
3 |
pip install sacremoses
|
4 |
-
#
|
5 |
-
#
|
6 |
-
#
|
7 |
-
# sklearn/pandas/plotly๋ ์ค์น ์ ํ๋๋ฐ?
|
8 |
-
# ์ฝ๋ฉ ๋จธ์ ์ ๊ธฐ๋ณธ์ ์ผ๋ก ์ค์น๋์ด์๋๋ฐ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ค์ด ์์
|
9 |
-
import gradio as gr #gradio๋ฅผ ๊ฐ์ ธ์์ ์ฐ๋๋ฐ ๋งค๋ฒ gradio ์ฌ์ฏ์ ์น๋๊ฒ ๊ท์ฐฎ์ผ๋ฉด
|
10 |
-
#as gr์ด๋ผ๊ณ ์ถ๊ฐํด์ ์ด ์ดํ๋ก๋ gr์ด๋ผ๊ณ ๋ง ์จ๋ ๋จ
|
11 |
-
#gradio๊ฐ ์น ์์์์ ๋ฐ๋ชจ๋ฅผ ๋ง๋ค์ด์ค (UI ํฌํจ)
|
12 |
import transformers # ํธ๋์คํฌ๋จธ(์ ๊ฒฝ๋ง์ ์ผ์ข
)
|
13 |
-
from transformers import pipeline
|
14 |
-
|
|
|
15 |
pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-ko-en")
|
16 |
-
|
17 |
demo = gr.Interface.from_pipeline(pipe)
|
18 |
-
# gradio๋ผ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ์ ์๋์ด์๋
|
19 |
# ๋ญ๋ก๋ถํฐ ๋ง๋๋๋ฉด pipe๋ก๋ถํฐ
|
20 |
-
# UI-> User Interface
|
21 |
-
demo.launch
|
|
|
1 |
pip install transformers gradio sentencepiece
|
2 |
pip install transformers[sentencepiece]
|
3 |
pip install sacremoses
|
4 |
+
import gradio as gr # gradio๋ฅผ ๊ฐ์ ธ์์ ์ฐ๋๋ฐ, ๋งค๋ฒ gradio ์ฌ์ฏ์ ์น๋๊ฒ ๊ท์ฐฎ์ผ๋ฉด
|
5 |
+
# as gr์ด๋ผ๊ณ ์ถ๊ฐํด์ ์ด ์ดํ๋ก๋ gr์ด๋ผ๊ณ ๋ง ์จ๋ ๋จ
|
6 |
+
# gradio๊ฐ ์น ์์์์ ๋ฐ๋ชจ๋ฅผ ๋ง๋ค์ด์ค (UI ํฌํจ!)
|
|
|
|
|
|
|
|
|
|
|
7 |
import transformers # ํธ๋์คํฌ๋จธ(์ ๊ฒฝ๋ง์ ์ผ์ข
)
|
8 |
+
from transformers import pipeline # ํ์ดํ๋ผ์ธ์ ๋จธ์ ๋ฌ๋ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ๋ฐ ํ์ํ
|
9 |
+
# ์ฌ๋ฌ ๊ตฌ์ฑ ์์๋ฅผ ๋ฌถ์ด์ค -> ๊ตฌ์ฑ ์์๋? ์) ๋ฌธ์ ์ ์ข
๋ฅ, ๋ชจ๋ธ์ ์ข
๋ฅ ๋ฑ
|
10 |
+
|
11 |
pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-ko-en")
|
12 |
+
# ๋ฌธ์ ์ ์ข
๋ฅ๋ ๋ฒ์ญ์ด๊ณ , ์ฐ๋ฆฌ๊ฐ ์ธ ๋ชจ๋ธ์ Hel.... en์ด๋ผ ๋ถ๋ฆฌ๋ ๋ชจ๋ธ
|
13 |
demo = gr.Interface.from_pipeline(pipe)
|
14 |
+
# gradio๋ผ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ์ ์๋์ด์๋ Interface๋ฅผ ๋ง๋ค์
|
15 |
# ๋ญ๋ก๋ถํฐ ๋ง๋๋๋ฉด pipe๋ก๋ถํฐ
|
16 |
+
# UI -> User Interface
|
17 |
+
demo.launch()
|