import requests class Skill: def __init__(self:object) -> None: pass def set_tokenizer(self:object, tokenizer:object): self.tokenizer = tokenizer def process(self:object, input_txt:str, history_list:list, role_card:dict): output_text:str = None if input_txt.startswith("上联:") or input_txt.startswith("上联:"): output_text = requests.post( url='https://hf.space/embed/lewiswu1209/gpt2-chinese-couplet/+/api/predict/', json={"data": [input_txt[3:]]} ).json()["data"][0] output_text = "我对下联:" + output_text return output_text, history_list, role_card