File size: 636 Bytes
810bd73
15fc488
7529a43
15fc488
 
7529a43
 
 
 
bf5a63a
 
 
 
15fc488
bf5a63a
15fc488
bf5a63a
7529a43
 
15fc488
 
7529a43
15fc488
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import gradio as gr
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline

# SKT 한국어 GPT 모델
model_id = "skt/ko-gpt-trinity-1.2B-v0.5"

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id)

pipe = pipeline(
    "text-generation",
    model=model,
    tokenizer=tokenizer,
    max_new_tokens=100,
    do_sample=True,
    temperature=0.7,
)

def chat(prompt):
    response = pipe(prompt)[0]["generated_text"]
    return response

gr.Interface(
    fn=chat,
    inputs="text",
    outputs="text",
    title="한국어 GPT 챗봇 (SKT Trinity 1.2B)"
).launch()