Spaces:
Runtime error
Runtime error
Nina
commited on
Commit
•
12f6ef4
1
Parent(s):
5cba42a
change to complete api_key as option
Browse files
app.py
CHANGED
@@ -89,14 +89,14 @@ def set_openai_api_key(text):
|
|
89 |
with gr.Blocks(title="Eki IPCC Explorer") as demo:
|
90 |
openai.api_key = os.environ["api_key"]
|
91 |
gr.Markdown("# Climate GPT")
|
92 |
-
with gr.Row():
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
|
101 |
gr.Markdown("""# Ask me anything, I'm a climate expert""")
|
102 |
with gr.Row():
|
@@ -115,11 +115,16 @@ with gr.Blocks(title="Eki IPCC Explorer") as demo:
|
|
115 |
sources_textbox = gr.Textbox(
|
116 |
interactive=False, show_label=False, max_lines=50
|
117 |
)
|
118 |
-
|
119 |
ask.submit(
|
120 |
fn=gen_conv, inputs=[ask, state], outputs=[chatbot, state, sources_textbox]
|
121 |
)
|
122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
openai_api_key_textbox.change(set_openai_api_key, inputs=[openai_api_key_textbox])
|
124 |
openai_api_key_textbox.submit(set_openai_api_key, inputs=[openai_api_key_textbox])
|
125 |
|
|
|
89 |
with gr.Blocks(title="Eki IPCC Explorer") as demo:
|
90 |
openai.api_key = os.environ["api_key"]
|
91 |
gr.Markdown("# Climate GPT")
|
92 |
+
# with gr.Row():
|
93 |
+
# gr.Markdown("First step: Add your OPENAI api key")
|
94 |
+
# openai_api_key_textbox = gr.Textbox(
|
95 |
+
# placeholder="Paste your OpenAI API key (sk-...) and hit Enter",
|
96 |
+
# show_label=False,
|
97 |
+
# lines=1,
|
98 |
+
# type="password",
|
99 |
+
# )
|
100 |
|
101 |
gr.Markdown("""# Ask me anything, I'm a climate expert""")
|
102 |
with gr.Row():
|
|
|
115 |
sources_textbox = gr.Textbox(
|
116 |
interactive=False, show_label=False, max_lines=50
|
117 |
)
|
|
|
118 |
ask.submit(
|
119 |
fn=gen_conv, inputs=[ask, state], outputs=[chatbot, state, sources_textbox]
|
120 |
)
|
121 |
+
with gr.Accordion("Add your personal openai api key", open=False):
|
122 |
+
openai_api_key_textbox = gr.Textbox(
|
123 |
+
placeholder="Paste your OpenAI API key (sk-...) and hit Enter",
|
124 |
+
show_label=False,
|
125 |
+
lines=1,
|
126 |
+
type="password",
|
127 |
+
)
|
128 |
openai_api_key_textbox.change(set_openai_api_key, inputs=[openai_api_key_textbox])
|
129 |
openai_api_key_textbox.submit(set_openai_api_key, inputs=[openai_api_key_textbox])
|
130 |
|