Go to file
xxmistacruzxx d2ebaffae5 Finished README. Rearranged options in .env.example. 2024-04-22 20:17:49 -04:00
alttextbackend Added versioning to requirements.txt. 2024-03-22 14:15:07 -04:00
.env.example Finished README. Rearranged options in .env.example. 2024-04-22 20:17:49 -04:00
.gitignore HUGE COMMIT. Essentially implemented every necessary route. Integrated database functionality. Setup a .env setup. Updated the openapi.yaml. 2024-02-29 19:01:00 -05:00
README.md Finished README. Rearranged options in .env.example. 2024-04-22 20:17:49 -04:00
db.sqlite3 Set up Djano REST Framework. Created two routes with GET and POST routes showing the intaking of body inputs. 2023-11-16 15:13:22 -05:00
manage.py Templated routes/views to be fulfilled. Added dotenv functionality. Updated requirements. 2024-02-09 14:11:31 -05:00
openapi.yaml HUGE COMMIT. Essentially implemented every necessary route. Integrated database functionality. Setup a .env setup. Updated the openapi.yaml. 2024-02-29 19:01:00 -05:00
requirements.txt Added versioning to requirements.txt. 2024-03-22 14:15:07 -04:00

README.md

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.