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