aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Wang2022-02-22 22:01:25 -0600
committerAnthony Wang2022-02-22 22:01:25 -0600
commit5e8f3591ca7bc3d441bf937b1a725951a7ea59bc (patch)
treeda5d05508b869038be9e7b5354148d0541135598
parent7f6be5c2ac8f7fc85923b55fd4a1c483eb5d5457 (diff)
Make sure post is at least 100 characters
-rw-r--r--bot.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/bot.py b/bot.py
index 6c37fa6..ea86b88 100644
--- a/bot.py
+++ b/bot.py
@@ -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)