Skip to content

Commit

Permalink
Update app.py
Browse files Browse the repository at this point in the history
Add support for environment variables using a .env file

Using a .env File (Recommended for Development):
- Created a .env file in the root directory to manage environment variables for development.
- Added CLAUDE_API_KEY to the .env file.

Instructions:
1. Add your environment variable to the file:
   CLAUDE_API_KEY=your_api_key_here

2. Install the python-dotenv package to read the .env file in your Python script:
   pip install python-dotenv

3. Updated the script to load the environment variables with the following code
  • Loading branch information
Charvi-14 authored Oct 1, 2024
1 parent a9c2f8d commit 8326e7d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@
import requests, random
from streamlit_lottie import st_lottie
from streamlit_option_menu import option_menu

import os
from dotenv import load_dotenv
#AI Integration
import anthropic

# Retrieve API key from Hugging Face secrets
claude_api_key = "api-key"
#Changes made by --Charvi Arora
#Added security
# Load environment variables from .env file
load_dotenv()
# Retrieve the API key
claude_api_key = os.getenv("CLAUDE_API_KEY")

# Initialize ClaudeAI client
client = anthropic.Client(api_key=claude_api_key)

def anxiety_management_guide(mood, feeling_description, current_stress_level, recent_events):
Expand Down

0 comments on commit 8326e7d

Please sign in to comment.