Skip to content

mateusmorato/aws-fastapi-gpt4

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sentiment Analysis FastAPI App built with GPT4 and AWS AppRunner

This is a simple FastAPI app that takes a string as input and returns a sentiment score from 1 (negative) to 10 (positive) using TextBlob for sentiment analysis.

VIDEO: How to use AWS AppRunner to deploy ChatGPT Python FastAPI Microservice

Blog post

Installation

Make sure you have Python 3.7 or higher installed.

  1. Install the required packages:
pip install fastapi uvicorn textblob httpx pytest
  1. Clone the repository or deploy it to AWS AppRunner as shown in this video.

Running the app

Start the app by running:

uvicorn main:app --host 0.0.0.0 --port 8080

The app will be available at http://127.0.0.1:8080.

API Endpoints

/sentiment (POST)

Takes a JSON payload with a "text" field and returns the sentiment score.

Example request:

{
  "text": "I love this!"
}

Example response:

{
  "sentiment_score": 10
}

Testing

To run the tests, execute:

pytest test_app.py
# or just
pytest

License

This project is licensed under the Apache License.

Acknowledgments

About

Deploy AI-generated application to AWS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%