antoniostorni / fastapi-streaming-sentences

A FastAPI application demonstrating real-time streaming of processed sentences. It showcases asynchronous handling of text data, tokenization, and sentence detection using NLTK, and streams the processed sentences back to the client.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FastAPI Streaming Sentences

This project is a demonstration of a FastAPI application that showcases real-time streaming of processed sentences. It utilizes asynchronous handling of text data, tokenizes input text, performs sentence detection using the Natural Language Toolkit (NLTK), and streams the processed sentences back to the client in real-time. This example serves as a practical demonstration of integrating natural language processing (NLP) techniques with FastAPI for dynamic content delivery.

Features

  • Asynchronous text processing and streaming
  • Real-time tokenization and sentence detection
  • Use of NLTK for natural language processing
  • Integration of FastAPI with HTML and JavaScript for dynamic web content

Installation

To install the required Python packages, run the following command:

pip install -r requirements.txt

Usage

To run the FastAPI server, execute the following command:

uvicorn main:app --reload

Runnning the Application with Docker

To run the FastAPI application using Docker, execute the following commands:

docker build -t fastapi-streaming-sentences .
docker run -d --name fastapi-streaming-sentences -p 9000:9000 fastapi-streaming-sentences

The application will be accessible at http://localhost:9000.

About

A FastAPI application demonstrating real-time streaming of processed sentences. It showcases asynchronous handling of text data, tokenization, and sentence detection using NLTK, and streams the processed sentences back to the client.


Languages

Language:HTML 46.6%Language:Python 44.6%Language:Dockerfile 8.8%