RAHULJUNEJA33 commited on
Commit
20f40da
·
verified ·
1 Parent(s): ac492b0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -1,12 +1,14 @@
1
- import os
2
  import openai
 
3
  import matplotlib.pyplot as plt
4
  from docx import Document
5
  from docx.shared import Inches
6
  from datetime import datetime
 
7
 
8
- # Set your OpenAI API Key securely using environment variables
9
- openai.api_key = os.getenv("OPENAI_API_KEY")
 
10
 
11
  def generate_text(prompt, role="user"):
12
  """Generate text using the new OpenAI API format."""
 
 
1
  import openai
2
+ import os
3
  import matplotlib.pyplot as plt
4
  from docx import Document
5
  from docx.shared import Inches
6
  from datetime import datetime
7
+ import streamlit as st
8
 
9
+ # Retrieve the OpenAI API Key from Streamlit secrets
10
+ openai_api_key = st.secrets["OPENAI_API_KEY"]
11
+ openai.api_key = openai_api_key # Set the OpenAI API key
12
 
13
  def generate_text(prompt, role="user"):
14
  """Generate text using the new OpenAI API format."""