markey/generate.py
ShittyKopper 2618b264f3 initial
2024-02-23 15:05:37 +03:00

29 lines
594 B
Python
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import chain
import sys
import requests
import secrets__
model_f = open("model.json")
model = chain.Text.from_json(model_f.read())
generated = False
text = None
while not generated:
text = model.make_short_sentence(80, tries=900, min_words=3)
generated = text is not None
text = text.replace('@','@').replace('#','#')
print(text)
requests.post("https://brain.d.on-t.work/api/notes/create", json={
'i': secrets__.TOKEN,
'visibility': 'home',
'noExtractMentions': True,
'noExtractHashtags': True,
'text': text,
'cw': 'markov chain generated post'
})