mrprycep069 commited on
Commit
8fcc6ac
1 Parent(s): a92bc3d

Update on the API-key

Browse files
Files changed (2) hide show
  1. .env +1 -0
  2. app.py +10 -2
.env ADDED
@@ -0,0 +1 @@
 
 
1
+ api_key=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
app.py CHANGED
@@ -11,13 +11,21 @@ Original file is located at
11
  # Commented out IPython magic to ensure Python compatibility.
12
  import openai
13
  import gradio
 
 
 
 
 
 
 
14
 
15
  # %pdb on
16
- openai.api_key = "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"
17
 
18
  menulist = [{"role": "system", "content": "You are ChatGPT Clone AI Robot"}]
19
 
20
  def ChatGPTclone(input):
 
21
  menulist.append({"role": "user", "content": input})
22
  response = openai.ChatCompletion.create(
23
  model = "gpt-3.5-turbo-16k-0613",
@@ -32,4 +40,4 @@ def application():
32
  app = gradio.Interface(fn=ChatGPTclone, inputs="text", outputs="text", title="ChatGPT Clone")
33
  return app.launch()
34
 
35
- application()
 
11
  # Commented out IPython magic to ensure Python compatibility.
12
  import openai
13
  import gradio
14
+ from dotenv import load_dotenv
15
+ import os
16
+
17
+
18
+
19
+ def configure():
20
+ load_dotenv()
21
 
22
  # %pdb on
23
+ openai.api_key = os.getenv('api_key')
24
 
25
  menulist = [{"role": "system", "content": "You are ChatGPT Clone AI Robot"}]
26
 
27
  def ChatGPTclone(input):
28
+ configure()
29
  menulist.append({"role": "user", "content": input})
30
  response = openai.ChatCompletion.create(
31
  model = "gpt-3.5-turbo-16k-0613",
 
40
  app = gradio.Interface(fn=ChatGPTclone, inputs="text", outputs="text", title="ChatGPT Clone")
41
  return app.launch()
42
 
43
+ application()