KOMUChat / model.py
ElPlaguister
Feat Special Token can be Replaced
c8a4b93
raw
history blame
738 Bytes
import gradio as gr
class Model:
def __init__(self,
name:str="Model",
placeholder:str="Input"):
self.name = name
self.placeholder = placeholder
self.model = None
self.tokenizer = None
self.gen_config = None
self.INPUT_FORMAT = None
def generate(self, inputs:str) -> str:
outputs = inputs
return outputs
def chat(self, message, chat_history):
response = self.generate(message)
response = response.replace('#ν™”μž#', 'λ„ˆ')
response = response.replace('#청자#', 'λ„ˆ')
chat_history.append((message, response))
return "", gr.Chatbot(chat_history, label=self.name, bubble_full_width=False)