CoolFace
Apppublic

muzammil-rehman-iub-edu-pk/bidirectional-sign-speech-translator

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
App README

Sign Speech Backend

This FastAPI backend powers the app's mobile-only features:

  • —Speech-to-text for Teacher mode
  • —Gesture recognition for Student mode

The Expo app calls this service using EXPO_PUBLIC_MOBILE_API_URL.

Local Development

Prerequisites

  • —Python 3.11+
  • —Homebrew
  • —ffmpeg for speech-to-text

Install ffmpeg:

bash
brew install ffmpeg

Setup

bash
cd backend
python3.11 -m venv .venv
source .venv/bin/activate
python -m pip install -U pip setuptools wheel
pip install -r requirements.txt

Run Locally

bash
python -m uvicorn main:app --host 0.0.0.0 --port 8000

Health checks:

  • —http://localhost:8000/
  • —http://localhost:8000/health

App Configuration

Set EXPO_PUBLIC_MOBILE_API_URL in the Expo app .env file.

Common values:

  • —iOS Simulator: http://localhost:8000
  • —Android Emulator: http://10.0.2.2:8000
  • —Physical device: http://<YOUR_MAC_LAN_IP>:8000

Hugging Face Spaces

This folder is ready to deploy as a Docker Space.

What To Upload

Create a new Hugging Face Space with SDK set to Docker, then push the contents of this backend/ folder to that Space repository root.

Required files already included here:

  • —README.md
  • —Dockerfile
  • —requirements.txt
  • —main.py

One-Command Push Helper

From the project root, you can push backend/ to your Space repo with:

bash
./deploy-backend-to-hf.sh https://huggingface.co/spaces/<username>/<space-name>

If your Space uses a branch other than main, pass it as the second argument:

bash
./deploy-backend-to-hf.sh https://huggingface.co/spaces/<username>/<space-name> main

Space Variables

Add these runtime variables in the Space Settings:

  • —WHISPER_MODEL=tiny
  • —WHISPER_DEVICE=cpu
  • —WHISPER_COMPUTE_TYPE=int8

Optional:

  • —HF_TOKEN if you want higher download limits for model pulls.

Expected Public URL

After deploy, Hugging Face gives you a URL like:

text
https://<your-space-name>.hf.space

Use that URL in the app:

env
EXPO_PUBLIC_MOBILE_API_URL=https://<your-space-name>.hf.space

Endpoints

  • —GET /
  • —GET /health
  • —POST /gesture
  • —POST /stt

Notes

  • —The first /stt request can be slow because Whisper may download the model on first use.
  • —Free CPU Spaces can sleep after inactivity and may cold start on the next request.
  • —tiny is the safest Whisper model for a free CPU deployment.