Editing
Ai Accessibility
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== <span style="color: #FFFFFF;">Applying</span> == '''AI image description for screen readers:''' <syntaxhighlight lang="python"> from transformers import BlipProcessor, BlipForConditionalGeneration from PIL import Image import requests import pyttsx3 # Text-to-speech for screen reader output # BLIP-2 image captioning model for accessibility processor = BlipProcessor.from_pretrained("Salesforce/blip-image-captioning-large") model = BlipForConditionalGeneration.from_pretrained( "Salesforce/blip-image-captioning-large" ).to("cuda") def describe_image_for_accessibility(image_path: str) -> str: """Generate detailed image description for blind users.""" image = Image.open(image_path).convert("RGB") # Unconditional captioning inputs = processor(image, return_tensors="pt").to("cuda") out = model.generate(**inputs, max_new_tokens=200, num_beams=5) base_description = processor.decode(out[0], skip_special_tokens=True) # Conditional probing for specific attributes questions = [ ("How many people are in this image?", "people count"), ("What colors are prominent?", "colors"), ("Is there any text visible in the image?", "text"), ] details = [] for question, aspect in questions: q_input = processor(image, question, return_tensors="pt").to("cuda") out = model.generate(**q_input, max_new_tokens=50) answer = processor.decode(out[0], skip_special_tokens=True) details.append(f"{aspect}: {answer}") return f"{base_description}. Details: {', '.join(details)}" # Screen reader output tts = pyttsx3.init() description = describe_image_for_accessibility("photo.jpg") tts.say(description) tts.runAndWait() </syntaxhighlight> </div> <div style="background-color: #8B4500; color: #FFFFFF; padding: 20px; border-radius: 8px; margin-bottom: 15px;">
Summary:
Please note that all contributions to BloomWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
BloomWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information