Skip to content

Repository files navigation

Python flask on Cloud Function example project

Welcome to the Python flask with Cloud Functions repository! This project demonstrates how to build a serverless Python flask application using Firebase Cloud Functions.

Overview

This repository contains the code and instructions for deploying a generative AI application using Firebase Cloud Functions. By leveraging LangChain and OpenAI's language model, the application provides a seamless and scalable solution for generating AI-powered content and responses.

Preparations

Install Node.js

Make sure you have Node.js installed by following these steps:

  1. Visit Node.js official website.
  2. Download the latest LTS version suitable for your operating system.
  3. Follow the installation instructions for your specific operating system.

Install Firebase Tools

Install Firebase Tools using npm (Node.js Package Manager) with the following steps:

npm install -g firebase-tools

Install Python

Ensure you have Python installed on your machine. Follow these steps:

  1. Visit Python official website.
  2. Download the latest stable version for your operating system.
  3. Follow the installation instructions, making sure to check the box that adds Python to your system PATH during installation.

Install virtualenv (venv)

Install virtualenv, a tool for creating isolated Python environments, with the following steps:

python -m pip install virtualenv

Development

Install Python Dependencies

Activate your virtual environment and install Python dependencies from the project's requirements.txt:

source ./functions/venv/bin/activate
python -m pip install -r ./functions/requirements.txt

Setup Variables

Set up the required environment variable:

export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES

Setup Local Dependencies

Create and activate a virtual environment for the project's local functions:

python -m venv functions/venv
source functions/venv/bin/activate
python -m pip install -r functions/requirements.txt

Run Local Backend with Firebase Cloud Functions

Start the local emulators for Firebase Cloud Functions:

firebase emulators:start

Contributing

We welcome contributions to enhance the functionality and improve the codebase. To contribute, follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
    git checkout -b feature-name
  3. Make your changes and commit them with descriptive messages.
    git commit -m "Add new feature"
  4. Push your changes to your forked repository.
    git push origin feature-name
  5. Open a pull request to merge your changes into the main repository.

License

This project is licensed under the MIT License. See the LICENSE file for details.


Thank you for using Generative AI with Cloud Functions! If you have any questions or need further assistance, feel free to open an issue in this repository. Happy coding!

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages