nilkanth007 commited on
Commit
0010519
·
verified ·
1 Parent(s): 623d321

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -18,6 +18,9 @@ st.title("Let's do code review for your python code")
18
  st.header("Please upload your .py file here:")
19
 
20
 
 
 
 
21
  # Function to download text content as a file using Streamlit
22
  def text_downloader(raw_text):
23
  # Generate a timestamp for the filename to ensure uniqueness
@@ -52,7 +55,7 @@ if data:
52
  st.write(fetched_data)
53
 
54
  # Initialize a ChatOpenAI instance with the specified model name "gpt-3.5-turbo" and a temperature of 0.9.
55
- chat = ChatOpenAI(os.getenv("OPENAI_API_KEY"),model_name="gpt-3.5-turbo", temperature=0.9)
56
 
57
  # Create a SystemMessage instance with the specified content, providing information about the assistant's role.
58
  systemMessage = SystemMessage(content="You are a code review assistant. Provide detailed suggestions to improve the given Python code along by mentioning the existing code line by line with proper indent")
 
18
  st.header("Please upload your .py file here:")
19
 
20
 
21
+ # Retrieve the API key from Hugging Face secret
22
+ api_key = os.getenv('OPENAI_API_KEY')
23
+
24
  # Function to download text content as a file using Streamlit
25
  def text_downloader(raw_text):
26
  # Generate a timestamp for the filename to ensure uniqueness
 
55
  st.write(fetched_data)
56
 
57
  # Initialize a ChatOpenAI instance with the specified model name "gpt-3.5-turbo" and a temperature of 0.9.
58
+ chat = ChatOpenAI(api_key,model_name="gpt-3.5-turbo", temperature=0.9)
59
 
60
  # Create a SystemMessage instance with the specified content, providing information about the assistant's role.
61
  systemMessage = SystemMessage(content="You are a code review assistant. Provide detailed suggestions to improve the given Python code along by mentioning the existing code line by line with proper indent")