Spaces:
Sleeping
Sleeping
metadata
title: AI-powered ASL text-to-video Generator
emoji: 🐻
colorFrom: blue
colorTo: yellow
sdk: gradio
sdk_version: 5.34.2
app_file: app.py
pinned: false
license: apache-2.0
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
AI-SL API
Convert text documents to American Sign Language (ASL) videos using AI.
Features
Dual Input Support with Optional File Upload
The app accepts both text input and file uploads with flexible options:
- Text Input: Type or paste text directly into the interface (always available)
- File Upload: Upload documents (PDF, TXT, DOCX, EPUB) - optional, can be enabled/disabled
- Smart Priority: Text input takes priority if both are provided
- Toggle Control: Checkbox to enable/disable file upload functionality
Video Output Options
The Gradio interface provides multiple ways for users to receive and download the generated ASL videos:
1. R2 Cloud Storage (Recommended)
- Videos are automatically uploaded to Cloudflare R2 storage
- Returns a public URL that users can download directly
- Videos persist and can be shared via URL
- Includes a styled download button in the interface
2. Base64 Encoding (Alternative)
- Videos are embedded as base64 data directly in the response
- No external storage required
- Good for smaller videos or when you want to avoid cloud storage
- Can be downloaded directly from the interface
3. Programmatic Access
Users can access the video output programmatically using:
from gradio_client import Client
# Connect to the running interface
client = Client("http://localhost:7860")
# Upload a document and get results
result = client.predict(
"path/to/document.pdf",
api_name="/predict"
)
# The result contains: (json_data, video_output, download_html)
json_data, video_url, download_html = result
# Download the video
import requests
response = requests.get(video_url)
with open("asl_video.mp4", "wb") as f:
f.write(response.content)
4. Direct Download from Interface
- The interface includes a styled download button
- Users can right-click and "Save As" if automatic download doesn't work
- Video files are named
asl_video.mp4
by default
Example Usage
Web Interface
- Visit your Space URL
- Choose input method:
- Text: Type or paste text in the text box (always available)
- File: Check "Enable file upload" and upload a document (optional)
- Click "Generate ASL Video"
- Download the resulting video
Programmatic Access with Optional File Upload
from gradio_client import Client
# Connect to your hosted app
client = Client("https://huggingface.co/spaces/your-username/your-space")
# Text input only (file upload disabled)
result = client.predict(
"Hello world! This is a test.", # Text input
False, # Enable file upload (False = disabled)
None, # File input (None since disabled)
True, # Use R2 storage
api_name="/predict"
)
# File input only (file upload enabled)
result = client.predict(
"", # Text input (empty)
True, # Enable file upload (True = enabled)
"document.pdf", # File input
True, # Use R2 storage
api_name="/predict"
)
# Both inputs (text takes priority)
result = client.predict(
"Quick text", # Text input
True, # Enable file upload (True = enabled)
"document.pdf", # File input
True, # Use R2 storage
api_name="/predict"
)
See example_usage.py
, example_usage_dual_input.py
, and example_optional_file_upload.py
for complete examples of how to:
- Download videos from URLs
- Process base64 video data
- Use the interface programmatically
- Perform further video processing
- Handle both text and file inputs
- Use optional file upload functionality
Requirements
- Python 3.7+
- Required packages listed in
requirements.txt
- Cloudflare R2 credentials (for cloud storage option)
- Supabase credentials for video database
Setup
- Install dependencies:
pip install -r requirements.txt
- Set up environment variables in
.env
file - Run the interface:
python app.py
Video Processing
Once you have the video file, you can:
- Upload to YouTube, Google Drive, or other services
- Analyze with OpenCV for computer vision tasks
- Convert to different formats
- Extract frames for further processing
- Add subtitles or overlays
Deployment to Hugging Face Spaces
- Create a new Space on Hugging Face
- Choose Gradio as the SDK
- Upload your code files
- Set environment variables in Space settings
- Deploy and share your Space URL
Your app will be accessible to users worldwide with flexible input options!