This project is a demo repository for an AI Bot that helps with translation. The bot is hosted in a FastAPI app and can be accessed from a simple website built with Streamlit or Gradio. The frontend allows users to select two languages (to/from) from the available options: English, Spanish, Chinese, and Japanese. The app targets the OpenAI GPT-4o-mini model hosted in Azure for translation.
- Python 3.10 or higher
- Azure account with access to OpenAI GPT-4o-mini
- API keys for Azure OpenAI
-
Clone the repository:
git clone https://github.com/jsburckhardt/ai-translation-bot-demo.git cd workspace-blank
-
Install the dependencies:
pip install -r requirements.txt
-
Navigate to the
app
directory:cd app
-
Start the FastAPI server:
uvicorn main:app --reload
-
Navigate to the
frontend
directory:cd frontend
-
Start the Streamlit or Gradio app:
streamlit run app.py # For Streamlit # or python app.py # For Gradio
You can use the provided Makefile
to run the frontend and backend simultaneously.
-
To run the frontend:
make frontend
-
To run the backend:
make backend
-
To run both frontend and backend:
make both
This project includes a .devcontainer
setup for development environments. The .devcontainer
directory contains the necessary configuration files to set up a development container using Visual Studio Code and Docker.
The project includes feedback functionality implemented in both the backend and frontend. Users can provide feedback on translations using thumbs up or thumbs down buttons.
You can use the test.rest
file to test the API endpoints. The file contains sample requests for the translation and feedback endpoints.
The requirements.txt
file lists all the dependencies for the project. Make sure to install them using the following command:
pip install -r requirements.txt
- Open your web browser and go to
http://localhost:8501
for Streamlit or the appropriate URL for Gradio. - Select the languages for translation (to/from).
- Input the text you want to translate and submit the form.
- View the translated text on the frontend.
- Provide feedback with thumbs up or thumbs down.
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License.