Ireneo's picture
Update app.py
b748808
raw
history blame
1.09 kB
import gradio as gr
import time
# Load the model
model = gr.Interface.load("models/roneneldan/TinyStories-Instruct-33M")
# Define additional inputs and outputs, if applicable
additional_input = gr.inputs.Textbox(label="Input Text", placeholder="Enter your story here...")
additional_output = gr.outputs.Textbox(label="Generated Story")
# Function to simulate typing effect
def typing_effect(text):
for char in text:
print(char, end='', flush=True) # Print character without newline
time.sleep(0.05) # Add a small delay between characters
print() # Print newline after the text is complete
# Launch the interface with added options and descriptions
model.launch(inputs=additional_input, outputs=additional_output, title="Tiny Stories Generator",
description="This model generates creative stories based on the input text provided.",
examples=[["Once upon a time..."]],
live=False, # Disable live updates to control the typing effect
fn=typing_effect) # Use the typing_effect function to display output