Skip to content

EbookFoundation/alt-text-backend

Repository files navigation

Alt-Text Backend

A OpenAPI documented REST API for the Alt-Text Project.

Developed as a Computer Science Senior Design Project at Stevens Institute of Technology in collaboration with the Free Ebook Foundation.

Learn more about the developers.

Getting Started

Installation

Alt-Text PyPi Package

You'll first need to install the PyPi package for the Alt-Text Project.

You can find the PyPi package here. To install the package via, you can execute the following in a terminal for your respective system...

Windows
py -m pip install alt-text

Unix/MacOS
python3 -m pip install alt-text

Postgres

The Alt-Text Backend needs an instance of Postgres to operate. You can use one hosted elsewhere or download Postgres.

Backend Dependencies

Make sure to install all the required PyPi dependencies for the backend using the following...

Windows
py -m pip install -r requirements.txt

Unix/MacOS
python3 -m pip install -r requirements.txt

Configuration

Before running the server, you'll need to start by configuring the settings of the server.

To start, rename the .env.example file to just .env.

Postgres Configuration

You'll need to change the database configuration settings to your appropriate credentials...

# DATABASE OPTIONS
DATABASE_NAME=postgres
DATABASE_HOST=127.0.0.1
DATABASE_USER=postgres
DATABASE_PASSWORD=testpassword
DATABASE_PORT=5432

General Analyzation Options

You can change the analyzation options to your liking...

## GENERAL OPTIONS
ALT_WITH_CONTEXT=1
ALT_WITH_HASH=1
ALT_MULTITHREADED=0
### ALT_VERSION OPTIONS: 1, 2
ALT_VERSION=2

Engine Options

The Alt-Text Backend requires that you have a Description, OCR, and Language Engine (info can be found at Alt-Text Project README).

Selecting Engine Types

You must declare which engines you are using.

## DESC_ENGINE OPTIONS: replicateapi, bliplocal, googlevertexapi
DESC_ENGINE=replicateapi
## OCR_ENGINE OPTIONS: tesseract
OCR_ENGINE=tesseract
## LANG_ENGINE OPTIONS: privategpt, openaiapi
LANG_ENGINE=openaiapi
Configuring Engine Options

You must fulfill the options for the engines you're using.

# DESC_ENGINE CONFIG OPTIONS
## REPLICATEAPI
REPLICATE_KEY=r8_somekey
## BLIPLOCAL
BLIPLOCAL_DIR=/path/to/image-captioning
## GOOGLEVERTEXAPI
VERTEX_PROJECT_ID=example-123456
### VERTEX_LOCATION OPTIONS: https://cloud.google.com/vertex-ai/docs/general/locations
VERTEX_LOCATION=us-central1
VERTEX_GAC_PATH=/path/to/vertex-key.json

# OCR_ENGINE CONFIG OPTIONS
## TESSERACT
TESSERACT_PATH=/path/to/tesseract.exe

# LANG_ENGINE CONFIG OPTIONS
## OPENAIAPI
OPENAI_API_KEY=sk-1234567890
### OPENAI_MODEL OPTIONS: https://platform.openai.com/docs/models
OPENAI_MODEL=gpt-3.5-turbo
## PRIVATEGPT
PRIVATEGPT_HOST=http://localhost:8001

Starting the Server

You can start the server with the following...

py manage.py runserver

Usage

You can see the all routes/features in the openapi.yaml file.

We'd recommend to use a visuallizer for it, such as Swagger.

Our Mission

The Alt-Text project is developed for the Free Ebook Foundation as a Senior Design Project at Stevens Institute of Technology.

As Ebooks become a more prominant way to consume written materials, it only becomes more important for them to be accessible to all people. Alternative text (aka alt-text) in Ebooks are used as a way for people to understand images in Ebooks if they are unable to use images as intended (e.g. a visual impaired person using a screen reader to read an Ebook).

While this feature exists, it is still not fully utilized and many Ebooks lack alt-text in some, or even all their images. To illustrate this, the Gutenberg Project, the creator of the Ebook and now a distributor of Public Domain Ebooks, have over 70,000 Ebooks in their collection and of those, there are about 470,000 images without alt-text (not including images with insufficient alt-text).

The Alt-Text project's goal is to use the power of various AI technologies, such as machine vision and large language models, to craft a solution capable of assisting in the creation of alt-text for Ebooks, closing the accessibility gap and improving collections, such as the Gutenberg Project.

Contact Information

The emails and relevant information of those involved in the Alt-Text project can be found below.

The Deveolpers

The Client

Advisor

APIs, Tools, & Libraries Used

Alt-Text Backend is developed using an assortment of tools...

Development Tools

Alt-Text Backend is developed using...

About

No description, website, or topics provided.

Resources

Code of conduct

Stars

Watchers

Forks

Sponsor this project

 

Languages