File size: 630 Bytes
f3c6b77
 
 
 
 
 
 
c1e6869
 
 
f3c6b77
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

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-poem/+/api/predict/',
                json={"data": [input_txt[3:]]}
            ).json()["data"][0]
        return  output_text, history_list, role_card