|
import gradio as gr |
|
import time |
|
|
|
|
|
model = gr.Interface.load("models/roneneldan/TinyStories-Instruct-33M") |
|
|
|
|
|
def simulate_typing(input_text): |
|
typing_speed = 0.05 |
|
generated_text = model.predict(input_text) |
|
for char in generated_text: |
|
time.sleep(typing_speed) |
|
|
|
|
|
|
|
return generated_text |
|
|
|
|
|
gr.Interface(fn=simulate_typing, inputs=gr.inputs.Textbox(label="Input Text", placeholder="Enter your story here..."), |
|
outputs=gr.outputs.Textbox(label="Generated Story"), title="Tiny Stories Generator", |
|
description="This model generates creative stories based on the input text provided.").launch() |
|
|