tarruck's picture
y
666bf02 verified
raw
history blame contribute delete
720 Bytes
from transformers import pipeline
from gtts import gTTS
import gradio as gr
# Load pre-trained summarization model
summarizer = pipeline("summarization", model="t5-small")
# Define the function
def dyslexia_assist(input_text):
# Simplify the text
simplified_text = summarizer(input_text, max_length=50, min_length=10, do_sample=False)[0]["summary_text"]
# Generate audio
tts = gTTS(simplified_text)
tts.save("simplified_audio.mp3")
return simplified_text, "simplified_audio.mp3"
# Create Gradio interface
interface = gr.Interface(
fn=dyslexia_assist,
inputs="text",
outputs=["text", "audio"],
title="Dyslexia Reading Assistant"
)
# Launch the app
interface.launch()