Skip to content

DGloi/utillity-files-to-text

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastAPI File Conversion Utility

This FastAPI utility provides an API to convert binary files to text using the BinaryToText class. It supports uploading files and converting them to plain text.

Features

  • Health Check Endpoint: Check the status of the API.
  • File Conversion Endpoint: Upload a file and convert it to plain text.

Endpoints

Health Check

  • URL: /health
  • Method: GET
  • Response: JSON object indicating the status of the API.

File Conversion

  • URL: /to_text
  • Method: POST
  • Request: Upload a file using multipart/form-data.
  • Response: Plain text content of the converted file.

Usage

Running the API

To run the API using docker, use the following command in the root directory of the repo :

docker build -f web-apps/api/dockerfile -t api .
docker run -p 8000:8000 api

Health check

Connect to http://localhost:8000/health to see if the service is running.

Converting files

You can try with example files stored in web-apps/api/test/data Run the following command

curl -X POST "http://localhost:8000/to_text" -H "accept: text/plain" -H "Content-Type: multipart/form-data" -F "file=@test.docx"

And change the file at your convenience.

About

Creates an endpoint to extract text content, images and document from different files format. Can be used in pyspark UDFs for bigdata retrieval.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors