Update app.py
Browse files
app.py
CHANGED
|
@@ -73,52 +73,77 @@ def generate_video_description(video):
|
|
| 73 |
# Gradio Interface
|
| 74 |
def main():
|
| 75 |
with gr.Blocks() as app:
|
| 76 |
-
gr.Markdown("<h1>AI-Powered Accessibility Tools</h1>")
|
| 77 |
|
| 78 |
# Text-to-Speech Section
|
| 79 |
-
gr.Markdown("<h2>Text-to-Speech</h2>")
|
| 80 |
-
gr.Markdown("**Core Idea:** Create natural-sounding speech from text input.\n"
|
| 81 |
-
"**Functionality:** Converts written text into spoken words, helping individuals with reading difficulties or visual impairments.\n"
|
| 82 |
-
"**Target Audience:** People with visual impairments, reading disabilities, and those who prefer audio content.")
|
| 83 |
-
gr.Markdown("Supported Input: **Plain text**. \nOutput: **MP3 audio file**.")
|
| 84 |
with gr.Row():
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
|
| 101 |
# Image Description Section
|
| 102 |
-
gr.
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
|
| 123 |
app.launch()
|
| 124 |
|
|
|
|
| 73 |
# Gradio Interface
|
| 74 |
def main():
|
| 75 |
with gr.Blocks() as app:
|
| 76 |
+
gr.Markdown("<h1 style='text-align: center; color: #1e90ff;'>AI-Powered Accessibility Tools</h1>")
|
| 77 |
|
| 78 |
# Text-to-Speech Section
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
with gr.Row():
|
| 80 |
+
with gr.Column(scale=1):
|
| 81 |
+
gr.Markdown("<div style='background-color: #f0f8ff; padding: 20px; border-radius: 8px;'>"
|
| 82 |
+
"<h2>Text-to-Speech</h2>"
|
| 83 |
+
"<ul>"
|
| 84 |
+
"<li><strong>Core Idea:</strong> Create natural-sounding speech from text input.</li>"
|
| 85 |
+
"<li><strong>Functionality:</strong> Converts written text into spoken words, helping individuals with reading difficulties or visual impairments.</li>"
|
| 86 |
+
"<li><strong>Target Audience:</strong> People with visual impairments, reading disabilities, and those who prefer audio content.</li>"
|
| 87 |
+
"</ul>"
|
| 88 |
+
"<strong>Supported Input:</strong> Plain text. <br>"
|
| 89 |
+
"<strong>Output:</strong> MP3 audio file."
|
| 90 |
+
"</div>")
|
| 91 |
+
text_input = gr.Textbox(label="Enter text for Text-to-Speech", placeholder="Type your text here...")
|
| 92 |
+
tts_button = gr.Button("Convert to Speech")
|
| 93 |
+
tts_output = gr.Audio(label="TTS Output")
|
| 94 |
+
tts_button.click(fn=text_to_speech, inputs=text_input, outputs=tts_output)
|
| 95 |
|
| 96 |
+
# Speech-to-Text Section
|
| 97 |
+
with gr.Column(scale=1):
|
| 98 |
+
gr.Markdown("<div style='background-color: #e6ffe6; padding: 20px; border-radius: 8px;'>"
|
| 99 |
+
"<h2>Speech-to-Text</h2>"
|
| 100 |
+
"<ul>"
|
| 101 |
+
"<li><strong>Core Idea:</strong> Convert spoken language into written text.</li>"
|
| 102 |
+
"<li><strong>Functionality:</strong> Allows users to dictate speech and have it transcribed into text, facilitating communication and documentation.</li>"
|
| 103 |
+
"<li><strong>Target Audience:</strong> Individuals with hearing impairments, those who prefer speaking over typing, and people with mobility challenges.</li>"
|
| 104 |
+
"</ul>"
|
| 105 |
+
"<strong>Supported Input:</strong> WAV, FLAC, AIFF, MP3 (converted to WAV). <br>"
|
| 106 |
+
"<strong>Output:</strong> Transcribed text."
|
| 107 |
+
"</div>")
|
| 108 |
+
stt_input = gr.Audio(label="Record or Upload Audio", type="filepath")
|
| 109 |
+
stt_button = gr.Button("Convert Speech to Text")
|
| 110 |
+
stt_output = gr.Textbox(label="Speech-to-Text Output")
|
| 111 |
+
stt_button.click(fn=speech_to_text, inputs=stt_input, outputs=stt_output)
|
| 112 |
|
| 113 |
# Image Description Section
|
| 114 |
+
with gr.Row():
|
| 115 |
+
with gr.Column(scale=1):
|
| 116 |
+
gr.Markdown("<div style='background-color: #ffe6e6; padding: 20px; border-radius: 8px;'>"
|
| 117 |
+
"<h2>Image Description</h2>"
|
| 118 |
+
"<ul>"
|
| 119 |
+
"<li><strong>Core Idea:</strong> Generate descriptive text for images.</li>"
|
| 120 |
+
"<li><strong>Functionality:</strong> Analyzes and describes the content of images, making visual information accessible to those who are visually impaired.</li>"
|
| 121 |
+
"<li><strong>Target Audience:</strong> Individuals with visual impairments and those needing assistance in understanding visual content.</li>"
|
| 122 |
+
"</ul>"
|
| 123 |
+
"<strong>Supported Input:</strong> JPEG, PNG, BMP, GIF. <br>"
|
| 124 |
+
"<strong>Output:</strong> Text description."
|
| 125 |
+
"</div>")
|
| 126 |
+
image_input = gr.Image(label="Upload an Image")
|
| 127 |
+
image_desc_output = gr.Textbox(label="Image Description")
|
| 128 |
+
image_desc_button = gr.Button("Describe Image")
|
| 129 |
+
image_desc_button.click(fn=generate_image_description, inputs=image_input, outputs=image_desc_output)
|
| 130 |
|
| 131 |
+
# Video Description Section
|
| 132 |
+
with gr.Column(scale=1):
|
| 133 |
+
gr.Markdown("<div style='background-color: #fff3e6; padding: 20px; border-radius: 8px;'>"
|
| 134 |
+
"<h2>Video Description</h2>"
|
| 135 |
+
"<ul>"
|
| 136 |
+
"<li><strong>Core Idea:</strong> Describe video content through generated text.</li>"
|
| 137 |
+
"<li><strong>Functionality:</strong> Provides textual descriptions of video frames, aiding understanding for those who cannot see the video.</li>"
|
| 138 |
+
"<li><strong>Target Audience:</strong> Individuals with visual impairments and those needing assistance in interpreting video content.</li>"
|
| 139 |
+
"</ul>"
|
| 140 |
+
"<strong>Supported Input:</strong> MP4, AVI, MOV. <br>"
|
| 141 |
+
"<strong>Output:</strong> List of text descriptions."
|
| 142 |
+
"</div>")
|
| 143 |
+
video_input = gr.File(label="Upload a Video", file_types=[".mp4", ".avi", ".mov"])
|
| 144 |
+
video_desc_output = gr.Textbox(label="Video Descriptions")
|
| 145 |
+
video_desc_button = gr.Button("Describe Video")
|
| 146 |
+
video_desc_button.click(fn=generate_video_description, inputs=video_input, outputs=video_desc_output)
|
| 147 |
|
| 148 |
app.launch()
|
| 149 |
|