Siddhant Kumar commited on
Commit
4b97fee
·
1 Parent(s): 95fc1be

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -11
app.py CHANGED
@@ -17,8 +17,6 @@ PINECONE_API_KEY = os.getenv("PINECONE_API_KEY")
17
  PINECONE_API_ENV = os.getenv("PINECONE_API_ENV")
18
  PINECONE_INDEX = os.getenv("PINECONE_INDEX")
19
 
20
- print(os.getenv("OPENAI_API_KEY"))
21
-
22
  # initialize pinecone
23
  pinecone.init(
24
  api_key=PINECONE_API_KEY, # find at app.pinecone.io
@@ -28,9 +26,6 @@ pinecone.init(
28
  index_name = PINECONE_INDEX
29
  vectorstore = Pinecone.from_existing_index(index_name=index_name, embedding=embeddings)
30
 
31
- api_key = os.getenv("OPENAI_API_KEY")
32
-
33
-
34
  class ChatWrapper:
35
 
36
  def __init__(self):
@@ -49,10 +44,7 @@ class ChatWrapper:
49
  # return history, history
50
  # Set OpenAI key
51
 
52
- if api_key:
53
- os.environ["OPENAI_API_KEY"] = api_key
54
- chain = get_chain(vectorstore)
55
- os.environ["OPENAI_API_KEY"] = ""
56
 
57
  import openai
58
  openai.api_key = os.getenv("OPENAI_API_KEY")
@@ -74,11 +66,11 @@ block = gr.Blocks(css=".gradio-container {background-color: #111827};footer "
74
  with block:
75
  # with gr.Row():
76
  # openai_api_key_textbox = gr.Textbox(
77
- # placeholder="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",
78
  # show_label=False,
79
  # lines=1,
80
  # type="password",
81
- # value="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"
82
  # )
83
 
84
  chatbot = gr.Chatbot().style(height=500)
 
17
  PINECONE_API_ENV = os.getenv("PINECONE_API_ENV")
18
  PINECONE_INDEX = os.getenv("PINECONE_INDEX")
19
 
 
 
20
  # initialize pinecone
21
  pinecone.init(
22
  api_key=PINECONE_API_KEY, # find at app.pinecone.io
 
26
  index_name = PINECONE_INDEX
27
  vectorstore = Pinecone.from_existing_index(index_name=index_name, embedding=embeddings)
28
 
 
 
 
29
  class ChatWrapper:
30
 
31
  def __init__(self):
 
44
  # return history, history
45
  # Set OpenAI key
46
 
47
+ chain = get_chain(vectorstore)
 
 
 
48
 
49
  import openai
50
  openai.api_key = os.getenv("OPENAI_API_KEY")
 
66
  with block:
67
  # with gr.Row():
68
  # openai_api_key_textbox = gr.Textbox(
69
+ # placeholder="",
70
  # show_label=False,
71
  # lines=1,
72
  # type="password",
73
+ # value=""
74
  # )
75
 
76
  chatbot = gr.Chatbot().style(height=500)