Spaces:
Runtime error
Runtime error
Nina
commited on
Commit
•
a327c68
1
Parent(s):
cb64d01
Fix indentation bug
Browse files
app.py
CHANGED
@@ -86,21 +86,19 @@ def set_openai_api_key(api_key):
|
|
86 |
openai.api_key = api_key
|
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 |
-
|
93 |
-
|
94 |
-
with gr.Row():
|
95 |
gr.Markdown("First step: Add your OPENAI api key")
|
96 |
openai_api_key_textbox = gr.Textbox(
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
gr.Markdown("""# Ask me anything, I'm a climate expert""")
|
105 |
with gr.Row():
|
106 |
with gr.Column(scale=2):
|
@@ -122,9 +120,8 @@ with gr.Blocks(title="Eki IPCC Explorer") as demo:
|
|
122 |
ask.submit(
|
123 |
fn=gen_conv, inputs=[ask, state], outputs=[chatbot, state, sources_textbox]
|
124 |
)
|
125 |
-
|
126 |
openai_api_key_textbox.change(set_openai_api_key, inputs=[openai_api_key_textbox])
|
127 |
openai_api_key_textbox.submit(set_openai_api_key, inputs=[openai_api_key_textbox])
|
128 |
|
129 |
demo.launch()
|
130 |
-
|
|
|
86 |
openai.api_key = api_key
|
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 |
+
gr.Markdown("# Climate GPT")
|
93 |
+
with gr.Row():
|
|
|
94 |
gr.Markdown("First step: Add your OPENAI api key")
|
95 |
openai_api_key_textbox = gr.Textbox(
|
96 |
+
placeholder="Paste your OpenAI API key (sk-...) and hit Enter",
|
97 |
+
show_label=False,
|
98 |
+
lines=1,
|
99 |
+
type="password",
|
100 |
+
)
|
101 |
+
|
|
|
102 |
gr.Markdown("""# Ask me anything, I'm a climate expert""")
|
103 |
with gr.Row():
|
104 |
with gr.Column(scale=2):
|
|
|
120 |
ask.submit(
|
121 |
fn=gen_conv, inputs=[ask, state], outputs=[chatbot, state, sources_textbox]
|
122 |
)
|
123 |
+
|
124 |
openai_api_key_textbox.change(set_openai_api_key, inputs=[openai_api_key_textbox])
|
125 |
openai_api_key_textbox.submit(set_openai_api_key, inputs=[openai_api_key_textbox])
|
126 |
|
127 |
demo.launch()
|
|