generator-oskov / app.py
ierhon's picture
Оптимизация
ce185db
raw
history blame
430 Bytes
import gradio as gr
import markovify
import random
with open(dataset, encoding="utf-8") as f:
db = f.read()
db = db.strip().lower()
def gen(text):
dataset = "./dataset.txt"
text_model = markovify.NewlineText(
input_text=db,
state_size=1,
well_formed=False
)
sentence = text_model.make_short_sentence(50)
return sentence
iface = gr.Interface(fn=gen, inputs="text", outputs="text")
iface.launch()