Spaces:
Running
Running
import gradio as gr | |
import markovify | |
import random | |
dataset = "./dataset.txt" | |
with open(dataset, encoding="utf-8") as f: | |
db = f.read() | |
db = db.strip().lower() | |
def gen(text): | |
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() |