Make sure post is at least 100 characters

This commit is contained in:
Anthony Wang 2022-02-22 22:01:25 -06:00
parent 7f6be5c2ac
commit 5e8f3591ca
Signed by: a
GPG key ID: BC96B00AEC5F2D76

7
bot.py
View file

@ -20,7 +20,7 @@ model = AutoModelForCausalLM.from_pretrained(args.model)
# Run the input through the model
inputs = tokenizer.encode(args.input, return_tensors="pt")
output = tokenizer.decode(model.generate(
inputs, do_sample=True, max_length=25, top_p=0.9, temperature=0.8)[0])
inputs, do_sample=True, max_length=75, top_p=0.9)[0])
print(output)
@ -29,4 +29,7 @@ mastodon = Mastodon(
access_token=args.token,
api_base_url=args.instance
)
mastodon.status_post(output)
post = output.split('\n')[0]
if len(post) < 100:
post = output.split('\n')[0] + '\n' + output.split('\n')[1]
mastodon.status_post(post)