File size: 753 Bytes
aa0f2ec
c90fdd5
aa0f2ec
bbc20a6
 
aa0f2ec
bbc20a6
47eae50
c90fdd5
 
 
aa0f2ec
 
 
 
47eae50
 
aa0f2ec
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import gradio as gr
class Model:
    def __init__(self,
            name:str="Model",
            placeholder:str="Input"):
        self.name = name
        self.placeholder = placeholder
        self.SPETIAL_TOKENS = ["#ν™”μž#", "#청자#", "#(λ‚¨μž)청자#", "#(λ‚¨μž)ν™”μž#", "#(μ—¬μž)청자#", "(μ—¬μž)ν™”μž"]
    
    def generate(self, inputs:str) -> str:
        outputs = inputs
        return outputs
    
    def chat(self, message, chat_history):
        response = self.generate(message)
        for special_token in self.SPETIAL_TOKENS:
            response = response.replace(special_token, 'λ„ˆ')
        chat_history.append((message, response))
        return "", gr.Chatbot(chat_history, label=self.name, bubble_full_width=False)