Winnie / bot /skills /poem.py
lewiswu1209's picture
add qa skills
c1e6869
raw
history blame contribute delete
No virus
630 Bytes
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