Nina commited on
Commit
adfbbbe
1 Parent(s): 60ffe88

test correcting manager secret issue with api key

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -14,9 +14,6 @@ document_store = FAISSDocumentStore.load(
14
 
15
  classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli")
16
  system_template = {"role": os.environ["role"], "content": os.environ["content"]}
17
- api_key_default = os.environ["api_key"]
18
- openai.api_key = api_key_default
19
-
20
 
21
  dense = EmbeddingRetriever(
22
  document_store=document_store,
@@ -83,15 +80,16 @@ def set_openai_api_key(text):
83
  """Set the api key and return chain.
84
  If no api_key, then None is returned.
85
  """
 
 
86
  if text.startswith("sk-") and len(text) > 10:
87
  openai.api_key = text
88
- else:
89
- openai.api_key = api_key_default
90
  return f"You're all set: this is your api key: {openai.api_key}"
91
 
92
 
93
  # Gradio
94
  with gr.Blocks(title="Eki IPCC Explorer") as demo:
 
95
  gr.Markdown("# Climate GPT")
96
  with gr.Row():
97
  gr.Markdown("First step: Add your OPENAI api key")
 
14
 
15
  classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli")
16
  system_template = {"role": os.environ["role"], "content": os.environ["content"]}
 
 
 
17
 
18
  dense = EmbeddingRetriever(
19
  document_store=document_store,
 
80
  """Set the api key and return chain.
81
  If no api_key, then None is returned.
82
  """
83
+ openai.api_key = os.environ["api_key"]
84
+
85
  if text.startswith("sk-") and len(text) > 10:
86
  openai.api_key = text
 
 
87
  return f"You're all set: this is your api key: {openai.api_key}"
88
 
89
 
90
  # Gradio
91
  with gr.Blocks(title="Eki IPCC Explorer") as demo:
92
+ openai.api_key = os.environ["api_key"]
93
  gr.Markdown("# Climate GPT")
94
  with gr.Row():
95
  gr.Markdown("First step: Add your OPENAI api key")