Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,22 +1,21 @@
|
|
| 1 |
from transformers import pipeline
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
-
#
|
| 5 |
generator = pipeline(
|
| 6 |
"text-generation",
|
| 7 |
-
model="
|
| 8 |
-
tokenizer="
|
| 9 |
-
device_map="auto"
|
| 10 |
)
|
| 11 |
|
| 12 |
def answer_question(prompt):
|
| 13 |
system_prompt = (
|
| 14 |
-
"๋๋ ํ๊ตญ
|
| 15 |
-
"
|
| 16 |
)
|
| 17 |
response = generator(
|
| 18 |
system_prompt + prompt,
|
| 19 |
-
max_new_tokens=
|
| 20 |
temperature=0.7,
|
| 21 |
top_p=0.9,
|
| 22 |
do_sample=True
|
|
@@ -28,11 +27,11 @@ app = gr.Interface(
|
|
| 28 |
inputs=gr.Textbox(
|
| 29 |
lines=2,
|
| 30 |
label="์
์ ์ง๋ฌธ ์
๋ ฅ",
|
| 31 |
-
placeholder="์:
|
| 32 |
),
|
| 33 |
outputs=gr.Textbox(label="AI ๋ต๋ณ"),
|
| 34 |
-
title="
|
| 35 |
-
description="
|
| 36 |
)
|
| 37 |
|
| 38 |
if __name__ == "__main__":
|
|
|
|
| 1 |
from transformers import pipeline
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
+
# ๋น ๋ฅธ ํ๊ตญ์ด GPT-2 ๋ชจ๋ธ ๋ก๋
|
| 5 |
generator = pipeline(
|
| 6 |
"text-generation",
|
| 7 |
+
model="skt/kogpt2-base-v2",
|
| 8 |
+
tokenizer="skt/kogpt2-base-v2"
|
|
|
|
| 9 |
)
|
| 10 |
|
| 11 |
def answer_question(prompt):
|
| 12 |
system_prompt = (
|
| 13 |
+
"๋๋ ํ๊ตญ ์
์์ ๋ณด๋ฅผ ์๋ ค์ฃผ๋ AI์ผ. "
|
| 14 |
+
"์ง๋ฌธ์ ๋ง๊ฒ ๊ฐ๋จ๋ช
๋ฃํ๊ฒ ์ค๋ช
ํด์ค.\n\n"
|
| 15 |
)
|
| 16 |
response = generator(
|
| 17 |
system_prompt + prompt,
|
| 18 |
+
max_new_tokens=150,
|
| 19 |
temperature=0.7,
|
| 20 |
top_p=0.9,
|
| 21 |
do_sample=True
|
|
|
|
| 27 |
inputs=gr.Textbox(
|
| 28 |
lines=2,
|
| 29 |
label="์
์ ์ง๋ฌธ ์
๋ ฅ",
|
| 30 |
+
placeholder="์: ์๋ฅ ์ผ์ / ํ๊ตญ๊ณตํ๋ ๋
ผ์ ์ ํ / ๊ฐ์ฒ๋ ๋ชจ์ง์ธ์"
|
| 31 |
),
|
| 32 |
outputs=gr.Textbox(label="AI ๋ต๋ณ"),
|
| 33 |
+
title="์
์์ ๋ณด AI (๋น ๋ฅธ ๋ฒ์ )",
|
| 34 |
+
description="CPU์์๋ ๋น ๋ฅด๊ฒ ์๋ํ๋ ์
์์ ๋ฌธ ์ฑ๋ด์
๋๋ค."
|
| 35 |
)
|
| 36 |
|
| 37 |
if __name__ == "__main__":
|