|
from transformers import pipeline |
|
from gtts import gTTS |
|
import gradio as gr |
|
|
|
|
|
summarizer = pipeline("summarization", model="t5-small") |
|
|
|
|
|
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" |
|
|
|
|
|
interface = gr.Interface( |
|
fn=dyslexia_assist, |
|
inputs="text", |
|
outputs=["text", "audio"], |
|
title="Dyslexia Reading Assistant" |
|
) |
|
|
|
|
|
interface.launch() |
|
|