Sk4467 commited on
Commit
a13be87
·
1 Parent(s): b851226

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -5,7 +5,15 @@ import ast
5
  # from gpt import get_chat_completion
6
  import openai
7
  openAiKey = st.text_input(label="Input the openai key", type="password")
8
- openai.api_key = openAiKey
 
 
 
 
 
 
 
 
9
  def get_chat_completion(prompt, model="gpt-3.5-turbo"):
10
  try:
11
  response = openai.ChatCompletion.create(
@@ -55,9 +63,9 @@ def main():
55
  Contributors:
56
  </div>
57
  <ul>
58
- <li class="list">MR PRADIPTA PATTANAYAK</li>
59
  <li class="list">MR LIKHIT NAYAK</li>
60
- <li class="list">MR ASHUTOS SAHOO</li>
 
61
  <li class="list">SK SHAHID</li>
62
  </ul>
63
  """, unsafe_allow_html=True)
 
5
  # from gpt import get_chat_completion
6
  import openai
7
  openAiKey = st.text_input(label="Input the openai key", type="password")
8
+ # openai.api_key = openAiKey
9
+
10
+ try:
11
+ openai.api_key = openaiKey
12
+ st.success("OpenAI key is valid!")
13
+ except Exception as e:
14
+ st.error(f"Invalid OpenAI key: {e}")
15
+ st.stop()
16
+
17
  def get_chat_completion(prompt, model="gpt-3.5-turbo"):
18
  try:
19
  response = openai.ChatCompletion.create(
 
63
  Contributors:
64
  </div>
65
  <ul>
 
66
  <li class="list">MR LIKHIT NAYAK</li>
67
+ <li class="list">MR PRADIPTA PATTANAYAK</li>
68
+ <li class="list">ASHUTOS SAHOO</li>
69
  <li class="list">SK SHAHID</li>
70
  </ul>
71
  """, unsafe_allow_html=True)