Spaces:
Running
Running
Arena
How to run locally
Set up a virtual environment
Before installing dependencies, it's recommended to create a virtual environment.
Install dependencies
With the virtual environment activated, install the project dependencies:
pip install -r requirements.txt
Run the app
Set your OpenAI API key as an environment variable and start the application:
GOOGLE_CLOUD_PROJECT=<your project id> CREDENTIALS_PATH=<your crednetials path> OPENAI_API_KEY=<your key> python3 app.py
Replace
<your project id>
,<your crednetials path>
, and<your key>
with your GCP project ID, the path to your GCP credentials file, and your OpenAI API key respectively.To run the app with auto-reloading, use
gradio app.py --demo-name app
instead ofpython3 app.py
.
Handling GCP credentials for development and deployment
Local environment
- Store your credentials in a file on your local machine.
- Set the
CREDENTIALS_PATH
environment variable to point to this file. - The application will read the credentials from this file when running locally.
Deployment environment
- Set the
CREDENTIALS
environment variable in your deployment platform's settings to your credentials JSON string. - The application will parse and use these credentials when deployed.