Spaces:
Paused
Paused
Commit
ยท
efdb5f5
1
Parent(s):
499634c
Update app.py
Browse files
app.py
CHANGED
@@ -32,7 +32,7 @@ examples = [
|
|
32 |
["It calculates soft weights for each word, more precisely for its embedding, in the context window. It can do it either in parallel (such as in transformers) or sequentially (such as recurrent neural networks). Soft weights can change during each runtime, in contrast to hard weights, which are (pre-)trained and fine-tuned and remain frozen afterwards. Attention was developed to address the weaknesses of recurrent neural networks, where words in a sentence are slowly processed one at a time. Machine learning-based attention is a mechanism mimicking cognitive attention. Recurrent neural networks favor more recent words at the end of a sentence while earlier words fade away in volatile neural activations. Attention gives all words equal access to any part of a sentence in a faster parallel scheme and no longer suffers the wait time of serial processing. Earlier uses attached this mechanism to a serial recurrent neural network's language translation system (below), but later uses in Transformers large language models removed the recurrent neural network and relied heavily on the faster parallel attention scheme.", "What is Attention mechanism?"]
|
33 |
]
|
34 |
|
35 |
-
|
36 |
# AI Tutor BERT
|
37 |
์ด ๋ชจ๋ธ์ ์ธ๊ณต์ง๋ฅ(AI) ๊ด๋ จ ์ฉ์ด ๋ฐ ์ค๋ช
์ ํ์ธํ๋(fine-tuning)ํ BERT ๋ชจ๋ธ์
๋๋ค.
|
38 |
## Model
|
@@ -40,21 +40,25 @@ markdown_text = """
|
|
40 |
๋ชจ๋ธ์ ๊ฒฝ์ฐ ์์ฐ์ด ์ฒ๋ฆฌ ๋ชจ๋ธ ์ค ๊ฐ์ฅ ์ ๋ช
ํ Google์์ ๊ฐ๋ฐํ BERT๋ฅผ ์ฌ์ฉํ์ต๋๋ค. ์์ธํ ์ค๋ช
์ ์ ์ฌ์ดํธ๋ฅผ ์ฐธ๊ณ ํ์๊ธฐ ๋ฐ๋๋๋ค. ์ง์์๋ต์ด ์ฃผ์ธ ๊ณผ์ธ ์ ์๋๋ต๊ฒ, BERT ์ค์์๋ ์ง์์๋ต์ ํนํ๋ Question and Answering ๋ชจ๋ธ์ ์ฌ์ฉํ์์ต๋๋ค.
|
41 |
|
42 |
## Dataset
|
43 |
-
|
44 |
-
https://
|
45 |
-
|
46 |
-
https://www.activeloop.ai/resources/glossary/arima-models/
|
47 |
-
### Adrien Beaulieu
|
48 |
-
https://product.house/100-ai-glossary-terms-explained-to-the-rest-of-us/
|
49 |
ํ์ต ๋ฐ์ดํฐ์
์ ์ธ๊ณต์ง๋ฅ ๊ด๋ จ ๋ฌธ๋งฅ, ์ง๋ฌธ, ๊ทธ๋ฆฌ๊ณ ์๋ต ์ด๋ ๊ฒ 3๊ฐ์ง๋ก ๊ตฌ์ฑ์ด ๋์ด์์ต๋๋ค. ์๋ต(์ ๋ต) ๋ฐ์ดํฐ๋ ๋ฌธ๋งฅ ๋ฐ์ดํฐ ์์ ํฌํจ๋์ด ์๊ณ , ๋ฌธ๋งฅ ๋ฐ์ดํฐ์ ๋ฌธ์ฅ ์์๋ฅผ ๋ฐ๊ฟ์ฃผ์ด ๋ฐ์ดํฐ๋ฅผ ์ฆ๊ฐํ์์ต๋๋ค. ์ง๋ฌธ ๋ฐ์ดํฐ๋ ์ฃผ์ ๊ฐ ๋๋ ์ธ๊ณต์ง๋ฅ ์ฉ์ด๋ก ์ค์ ํ์ต๋๋ค. ์์ ์์๋ฅผ ๋ณด์๋ฉด ์ดํดํ์๊ธฐ ํธํ์ค ๊ฒ๋๋ค. ์ด ๋ฐ์ดํฐ ์๋ 3300์ฌ ๊ฐ๋ก data ํด๋์ pickle ํ์ผ ํํ๋ก ์ ์ฅ๋์ด ์๊ณ , ๋ฐ์ดํฐ๋ Wikipedia ๋ฐ ๋ค๋ฅธ ์ฌ์ดํธ๋ค์ ์์ html์ ์ด์ฉํ์ฌ ์ถ์ถ ๋ฐ ๊ฐ๊ณตํ์ฌ ์ ์ํ์์ต๋๋ค. ํด๋น ์ถ์ฒ๋ ์์ ๊ฐ์ต๋๋ค.
|
|
|
50 |
## How to use
|
51 |
์
๋ ฅ ์์ ๋ 'Examples'์ ํ๊ธฐํด ๋์์ต๋๋ค.
|
52 |
๊ด๋ จ ๋ฌธ์ฅ๊ณผ ์ ์๋ฅผ ์๊ณ ์ถ์ ๋จ์ด๋ฅผ ๊ฐ๊ฐ `Contexts`, `Question`์ ์
๋ ฅํ ํ `Submit` ๋ฒํผ์ ๋๋ฅด๋ฉด ํด๋น ๋จ์ด์ ๋ํ ์ค๋ช
์ด ๋์ต๋๋ค.
|
53 |
-
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
iface = gr.Interface(
|
56 |
fn=submit,
|
57 |
-
inputs=
|
58 |
outputs=gr.Textbox("Answer"),
|
59 |
examples=examples,
|
60 |
live=True, # Set live to True to use the submit button
|
|
|
32 |
["It calculates soft weights for each word, more precisely for its embedding, in the context window. It can do it either in parallel (such as in transformers) or sequentially (such as recurrent neural networks). Soft weights can change during each runtime, in contrast to hard weights, which are (pre-)trained and fine-tuned and remain frozen afterwards. Attention was developed to address the weaknesses of recurrent neural networks, where words in a sentence are slowly processed one at a time. Machine learning-based attention is a mechanism mimicking cognitive attention. Recurrent neural networks favor more recent words at the end of a sentence while earlier words fade away in volatile neural activations. Attention gives all words equal access to any part of a sentence in a faster parallel scheme and no longer suffers the wait time of serial processing. Earlier uses attached this mechanism to a serial recurrent neural network's language translation system (below), but later uses in Transformers large language models removed the recurrent neural network and relied heavily on the faster parallel attention scheme.", "What is Attention mechanism?"]
|
33 |
]
|
34 |
|
35 |
+
gr.Markdown("""
|
36 |
# AI Tutor BERT
|
37 |
์ด ๋ชจ๋ธ์ ์ธ๊ณต์ง๋ฅ(AI) ๊ด๋ จ ์ฉ์ด ๋ฐ ์ค๋ช
์ ํ์ธํ๋(fine-tuning)ํ BERT ๋ชจ๋ธ์
๋๋ค.
|
38 |
## Model
|
|
|
40 |
๋ชจ๋ธ์ ๊ฒฝ์ฐ ์์ฐ์ด ์ฒ๋ฆฌ ๋ชจ๋ธ ์ค ๊ฐ์ฅ ์ ๋ช
ํ Google์์ ๊ฐ๋ฐํ BERT๋ฅผ ์ฌ์ฉํ์ต๋๋ค. ์์ธํ ์ค๋ช
์ ์ ์ฌ์ดํธ๋ฅผ ์ฐธ๊ณ ํ์๊ธฐ ๋ฐ๋๋๋ค. ์ง์์๋ต์ด ์ฃผ์ธ ๊ณผ์ธ ์ ์๋๋ต๊ฒ, BERT ์ค์์๋ ์ง์์๋ต์ ํนํ๋ Question and Answering ๋ชจ๋ธ์ ์ฌ์ฉํ์์ต๋๋ค.
|
41 |
|
42 |
## Dataset
|
43 |
+
[Wikipedia] https://en.wikipedia.org/wiki/Main_Page
|
44 |
+
[activeloop] https://www.activeloop.ai/resources/glossary/arima-models/
|
45 |
+
[Adrien Beaulieu] https://product.house/100-ai-glossary-terms-explained-to-the-rest-of-us/
|
|
|
|
|
|
|
46 |
ํ์ต ๋ฐ์ดํฐ์
์ ์ธ๊ณต์ง๋ฅ ๊ด๋ จ ๋ฌธ๋งฅ, ์ง๋ฌธ, ๊ทธ๋ฆฌ๊ณ ์๋ต ์ด๋ ๊ฒ 3๊ฐ์ง๋ก ๊ตฌ์ฑ์ด ๋์ด์์ต๋๋ค. ์๋ต(์ ๋ต) ๋ฐ์ดํฐ๋ ๋ฌธ๋งฅ ๋ฐ์ดํฐ ์์ ํฌํจ๋์ด ์๊ณ , ๋ฌธ๋งฅ ๋ฐ์ดํฐ์ ๋ฌธ์ฅ ์์๋ฅผ ๋ฐ๊ฟ์ฃผ์ด ๋ฐ์ดํฐ๋ฅผ ์ฆ๊ฐํ์์ต๋๋ค. ์ง๋ฌธ ๋ฐ์ดํฐ๋ ์ฃผ์ ๊ฐ ๋๋ ์ธ๊ณต์ง๋ฅ ์ฉ์ด๋ก ์ค์ ํ์ต๋๋ค. ์์ ์์๋ฅผ ๋ณด์๋ฉด ์ดํดํ์๊ธฐ ํธํ์ค ๊ฒ๋๋ค. ์ด ๋ฐ์ดํฐ ์๋ 3300์ฌ ๊ฐ๋ก data ํด๋์ pickle ํ์ผ ํํ๋ก ์ ์ฅ๋์ด ์๊ณ , ๋ฐ์ดํฐ๋ Wikipedia ๋ฐ ๋ค๋ฅธ ์ฌ์ดํธ๋ค์ ์์ html์ ์ด์ฉํ์ฌ ์ถ์ถ ๋ฐ ๊ฐ๊ณตํ์ฌ ์ ์ํ์์ต๋๋ค. ํด๋น ์ถ์ฒ๋ ์์ ๊ฐ์ต๋๋ค.
|
47 |
+
|
48 |
## How to use
|
49 |
์
๋ ฅ ์์ ๋ 'Examples'์ ํ๊ธฐํด ๋์์ต๋๋ค.
|
50 |
๊ด๋ จ ๋ฌธ์ฅ๊ณผ ์ ์๋ฅผ ์๊ณ ์ถ์ ๋จ์ด๋ฅผ ๊ฐ๊ฐ `Contexts`, `Question`์ ์
๋ ฅํ ํ `Submit` ๋ฒํผ์ ๋๋ฅด๋ฉด ํด๋น ๋จ์ด์ ๋ํ ์ค๋ช
์ด ๋์ต๋๋ค.
|
51 |
+
""")
|
52 |
+
|
53 |
+
input_textbox = gr.Textbox("Context", placeholder="Enter context here")
|
54 |
+
question_textbox = gr.Textbox("Question", placeholder="Enter question here")
|
55 |
+
|
56 |
+
input_section = gr.Row([input_textbox, question_textbox])
|
57 |
+
|
58 |
|
59 |
iface = gr.Interface(
|
60 |
fn=submit,
|
61 |
+
inputs=input_section,
|
62 |
outputs=gr.Textbox("Answer"),
|
63 |
examples=examples,
|
64 |
live=True, # Set live to True to use the submit button
|