Download README.md from shoaibahmed912/transcript-data-backend: direct link, hf CLI and curl.
- Browser
- Download file 3.45 kB
-
https://huggingface.co/spaces/shoaibahmed912/transcript-data-backend/resolve/main/README.md
- Command line
-
hf download hf://spaces/shoaibahmed912/transcript-data-backend/README.md
-
curl -L -o README.md https://huggingface.co/spaces/shoaibahmed912/transcript-data-backend/resolve/main/README.md
title: Transcript Extraction Backend
emoji: 📄
colorFrom: blue
colorTo: green
sdk: docker
app_port: 7860
Transcript Extraction Backend
FastAPI backend that accepts transcript uploads (jpg, jpeg, jpp, png, or pdf) and returns a structured JSON object with personal details, semesters, subjects, marks, credit hours, GPA, and CGPA where available.
The extraction path is deployable and free-tier friendly:
- FastAPI receives a transcript file
- Gemini reads the uploaded PDF/image directly
- Gemini returns the normalized JSON response
Setup
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
Create a local .env file:
GEMINI_API_KEY=your_gemini_api_key_here
GEMINI_MODEL=gemini-2.5-flash
FIREBASE_SERVICE_ACCOUNT_BASE64=base64_encoded_firebase_service_account_json
TEST_AUTH_TOKEN=local-test-token
Run
uvicorn app.main:app --reload
Open:
http://127.0.0.1:8000/docs
Extract Transcript
curl -X POST "http://127.0.0.1:8000/extract" \
-H "Authorization: Bearer FIREBASE_ID_TOKEN_FROM_MOBILE_APP" \
-F "file=@/path/to/transcript.pdf"
Firebase Authentication
The mobile app signs the user in with Firebase Auth, gets the user's ID token, and sends it to this backend:
Authorization: Bearer <firebase_id_token>
The backend verifies that token with Firebase Admin SDK before processing /extract.
For local Swagger testing only, set TEST_AUTH_TOKEN in .env, restart the server, and enter the same value in the test_auth_token parameter shown on /extract. Do not set TEST_AUTH_TOKEN in production.
To configure the backend, create a Firebase service account:
- Open Firebase Console.
- Go to Project settings.
- Open Service accounts.
- Generate a new private key.
- Convert the JSON file to base64 and put it into
FIREBASE_SERVICE_ACCOUNT_BASE64in.envlocally or in your cloud host environment variables.
On macOS:
base64 -i firebase-service-account.json
Do not commit the service account JSON file or paste it into mobile app code.
Free Cloud LLM
For deployment, use the Gemini API free tier. Create an API key in Google AI Studio, then set it as an environment variable in your cloud host:
export GEMINI_API_KEY=your_api_key_here
export GEMINI_MODEL=gemini-2.5-flash
uvicorn app.main:app --reload
The backend sends the uploaded transcript file directly to Gemini and asks it to normalize the transcript into the response JSON schema. If Gemini is not configured, rate-limited, or returns invalid JSON, the API returns an error.
Deploy On Hugging Face Spaces
This repo includes a Dockerfile for Hugging Face Spaces deployment.
Create a new Space:
- Go to
https://huggingface.co/spaces. - Click
Create new Space. - Choose a name, for example
transcript-data-backend. - Choose
Dockeras the SDK. - Choose
CPU Basic. - Create the Space.
- Upload or push this repository to the Space repo.
Add these as Space secrets:
GEMINI_API_KEY=your_gemini_key
GEMINI_MODEL=gemini-2.5-flash
FIREBASE_SERVICE_ACCOUNT_BASE64=base64_encoded_firebase_service_account_json
Do not set TEST_AUTH_TOKEN in production.
After the Space builds, open:
https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME
The API docs should be available at:
https://YOUR_USERNAME-YOUR_SPACE_NAME.hf.space/docs