Nina commited on
Commit
12574b1
1 Parent(s): 9655619

add feedback status

Browse files
Files changed (1) hide show
  1. app.py +87 -70
app.py CHANGED
@@ -140,7 +140,7 @@ def save_feedback(feed: str, user_id):
140
  "time": timestamp,
141
  }
142
  log_on_azure(file, logs, share_client)
143
- return "Thanks for your feedbacks"
144
 
145
 
146
  def reset_textbox():
@@ -155,13 +155,16 @@ def log_on_azure(file, logs, share_client):
155
  with gr.Blocks(title="🌍 ClimateGPT", css="style.css") as demo:
156
 
157
  user_id_state = gr.State([user_id])
158
-
159
  # Gradio
160
  gr.Markdown("<h1><center>ClimateGPT 🌍</center></h1>")
161
- gr.Markdown("<h4><center>Ask climate-related questions to the IPCC reports</center></h4>")
 
 
162
  with gr.Row():
163
  with gr.Column(scale=1):
164
- gr.Markdown("""
 
165
  <p><b>Climate change and environmental disruptions have become some of the most pressing challenges facing our planet today</b>. As global temperatures rise and ecosystems suffer, it is essential for individuals to understand the gravity of the situation in order to make informed decisions and advocate for appropriate policy changes.</p>
166
  <p>However, comprehending the vast and complex scientific information can be daunting, as the scientific consensus references, such as <b>the Intergovernmental Panel on Climate Change (IPCC) reports, span thousands of pages</b> and are often laden with technical jargon. To bridge this gap and make climate science more accessible, we introduce <b>ClimateGPT as a tool to distill expert-level knowledge into easily digestible insights about climate science.</b></p>
167
  <div class="tip-box">
@@ -173,12 +176,13 @@ ClimateGPT harnesses modern OCR techniques to parse and preprocess IPCC reports.
173
  </div>
174
 
175
  """
176
- )
177
 
178
  with gr.Column(scale=1):
179
  gr.Markdown("![](https://i.postimg.cc/fLvsvMzM/Untitled-design-5.png)")
180
- gr.Markdown("*Source : IPCC AR6 - Synthesis Report of the IPCC 6th assessment report (AR6)*")
181
-
 
182
 
183
  with gr.Row():
184
  with gr.Column(scale=2):
@@ -191,42 +195,44 @@ ClimateGPT harnesses modern OCR techniques to parse and preprocess IPCC reports.
191
  placeholder="Ask here your climate-related question and press enter",
192
  ).style(container=False)
193
 
194
- examples_questions = gr.Examples([
195
- "What are the main causes of climate change?",
196
- "What are the impacts of climate change?",
197
- "Can climate change be reversed?",
198
- "What is the difference between climate change and global warming?",
199
- "What can individuals do to address climate change?",
200
- "What evidence do we have of climate change?",
201
- "What is the Paris Agreement and why is it important?",
202
- "Which industries have the highest GHG emissions?",
203
- "Is climate change caused by humans?",
204
- "What are the different greenhouse gases (GHG)?",
205
- "What is the warming power of methane?",
206
- "What is the jet stream?",
207
- "What is the breakdown of carbon sinks?",
208
- "How do the GHGs work ? Why does temperature increase ?",
209
- "What is the impact of global warming on ocean currents?",
210
- "How much warming is possible in 2050?",
211
- "What is the impact of climate change in Africa?",
212
- "What is the impact of rising sea levels?",
213
- "Will climate change accelerate diseases and epidemics like COVID?",
214
- "What are the economic impacts of climate change?",
215
- "What is the link between gender equality and climate change?",
216
- "How much is the cost of inaction ?",
217
- "What is the relationship between climate change and poverty?",
218
- "What is the relationship between climate change and biodiversity loss?",
219
- "What are the most effective strategies and technologies for reducing greenhouse gas (GHG) emissions?",
220
- "Is economic growth possible? What do you think about degrowth?",
221
- "Will technology save us?",
222
- "Is climate change a natural phenomenon ?",
223
- "Is climate change really happening or is it just a natural fluctuation in Earth's temperature?",
224
- "Is the scientific consensus on climate change really as strong as it is claimed to be?",
225
- "Is the impact of climate change really as severe as it is claimed to be?",
226
- "Is climate change a hoax created by the government or environmental organizations?"
227
- ],[ask])
228
-
229
-
 
 
230
  with gr.Column(scale=1, variant="panel"):
231
  gr.Markdown("### Sources")
232
  sources_textbox = gr.Textbox(
@@ -251,7 +257,8 @@ ClimateGPT harnesses modern OCR techniques to parse and preprocess IPCC reports.
251
  gr.Markdown("## How to use ClimateGPT")
252
  with gr.Row():
253
  with gr.Column(scale=1):
254
- gr.Markdown("""
 
255
  ### 💪 Getting started
256
  - In the chatbot section, simply type your climate-related question, and ClimateGPT will provide an answer with references to relevant IPCC reports.
257
  - ClimateGPT retrieves specific passages from the IPCC reports to help answer your question accurately.
@@ -259,10 +266,11 @@ ClimateGPT harnesses modern OCR techniques to parse and preprocess IPCC reports.
259
  - Feel free to ask follow-up questions within the chatbot for a more in-depth understanding.
260
  - ClimateGPT integrates multiple sources (IPCC, IPBES, IEA, Limits to Growth, … ) to cover various aspects of environmental science, such as climate change, biodiversity, energy, economy, and pollution. See all sources used below.
261
  """
262
- )
263
  with gr.Column(scale=1):
264
 
265
- gr.Markdown("""
 
266
  ### ⚠️ Limitations
267
  <div class="warning-box">
268
  <ul>
@@ -272,45 +280,53 @@ ClimateGPT harnesses modern OCR techniques to parse and preprocess IPCC reports.
272
  </div>
273
  """
274
  )
275
-
276
  with gr.Row():
277
- with gr.Column(scale = 1):
278
  gr.Markdown("## 🙏 Feedback and feature requests")
279
- gr.Markdown("""
 
280
  ### Beta test
281
  - ClimateGPT welcomes community contributions. To participate, head over to the Community Tab and create a "New Discussion" to ask questions and share your insights.
282
  - Provide feedback through our feedback form, letting us know which insights you found accurate, useful, or not. Your input will help us improve the platform.
283
  - Only a few sources (see below) are integrated (all IPCC, IPBES, IEA recent reports), if you are a climate science researcher and net to sift through another report, please let us know.
284
  ### Feedbacks
285
- """)
286
-
287
- feedback = gr.Textbox()
288
- feedback_save = gr.Button(value="submit feedback")
289
- # thanks = gr.Textbox()
290
- feedback_save.click(
291
- save_feedback,
292
- inputs=[feedback, user_id_state], # outputs=[thanks]
293
  )
294
- gr.Markdown("If you need us to ask another climate science report or ask any question, contact us at <b>theo.alvesdacosta@ekimetrics.com</b>")
295
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
 
297
- with gr.Column(scale = 1):
 
298
  gr.Markdown("## OpenAI API")
299
- gr.Markdown("To make climate science accessible to a wider audience, we have opened our own OpenAI API key with a monthly cap of $1000. If you already have an API key, please use it to help conserve bandwidth for others.")
 
 
300
  openai_api_key_textbox = gr.Textbox(
301
  placeholder="Paste your OpenAI API key (sk-...) and hit Enter",
302
  show_label=False,
303
  lines=1,
304
  type="password",
305
  )
306
- openai_api_key_textbox.change(
307
- set_openai_api_key, inputs=[openai_api_key_textbox]
308
- )
309
- openai_api_key_textbox.submit(
310
- set_openai_api_key, inputs=[openai_api_key_textbox]
311
- )
312
 
313
- gr.Markdown("""
 
314
 
315
 
316
  ## 📚 Sources
@@ -346,8 +362,9 @@ Carbon emissions were measured during the development and inference process usin
346
  This tool has been developed by the R&D lab at **Ekimetrics** (Jean Lelong, Nina Achache, Gabriel Olympie, Nicolas Chesneau, Natalia De la Calzada, Théo Alves Da Costa)
347
 
348
  If you have any questions or feature requests, please feel free to reach us out at <b>theo.alvesdacosta@ekimetrics.com</b>.
349
- """)
350
-
 
351
  demo.queue(concurrency_count=16)
352
 
353
  demo.launch()
 
140
  "time": timestamp,
141
  }
142
  log_on_azure(file, logs, share_client)
143
+ return "Feedback submitted, thank you!"
144
 
145
 
146
  def reset_textbox():
 
155
  with gr.Blocks(title="🌍 ClimateGPT", css="style.css") as demo:
156
 
157
  user_id_state = gr.State([user_id])
158
+
159
  # Gradio
160
  gr.Markdown("<h1><center>ClimateGPT 🌍</center></h1>")
161
+ gr.Markdown(
162
+ "<h4><center>Ask climate-related questions to the IPCC reports</center></h4>"
163
+ )
164
  with gr.Row():
165
  with gr.Column(scale=1):
166
+ gr.Markdown(
167
+ """
168
  <p><b>Climate change and environmental disruptions have become some of the most pressing challenges facing our planet today</b>. As global temperatures rise and ecosystems suffer, it is essential for individuals to understand the gravity of the situation in order to make informed decisions and advocate for appropriate policy changes.</p>
169
  <p>However, comprehending the vast and complex scientific information can be daunting, as the scientific consensus references, such as <b>the Intergovernmental Panel on Climate Change (IPCC) reports, span thousands of pages</b> and are often laden with technical jargon. To bridge this gap and make climate science more accessible, we introduce <b>ClimateGPT as a tool to distill expert-level knowledge into easily digestible insights about climate science.</b></p>
170
  <div class="tip-box">
 
176
  </div>
177
 
178
  """
179
+ )
180
 
181
  with gr.Column(scale=1):
182
  gr.Markdown("![](https://i.postimg.cc/fLvsvMzM/Untitled-design-5.png)")
183
+ gr.Markdown(
184
+ "*Source : IPCC AR6 - Synthesis Report of the IPCC 6th assessment report (AR6)*"
185
+ )
186
 
187
  with gr.Row():
188
  with gr.Column(scale=2):
 
195
  placeholder="Ask here your climate-related question and press enter",
196
  ).style(container=False)
197
 
198
+ examples_questions = gr.Examples(
199
+ [
200
+ "What are the main causes of climate change?",
201
+ "What are the impacts of climate change?",
202
+ "Can climate change be reversed?",
203
+ "What is the difference between climate change and global warming?",
204
+ "What can individuals do to address climate change?",
205
+ "What evidence do we have of climate change?",
206
+ "What is the Paris Agreement and why is it important?",
207
+ "Which industries have the highest GHG emissions?",
208
+ "Is climate change caused by humans?",
209
+ "What are the different greenhouse gases (GHG)?",
210
+ "What is the warming power of methane?",
211
+ "What is the jet stream?",
212
+ "What is the breakdown of carbon sinks?",
213
+ "How do the GHGs work ? Why does temperature increase ?",
214
+ "What is the impact of global warming on ocean currents?",
215
+ "How much warming is possible in 2050?",
216
+ "What is the impact of climate change in Africa?",
217
+ "What is the impact of rising sea levels?",
218
+ "Will climate change accelerate diseases and epidemics like COVID?",
219
+ "What are the economic impacts of climate change?",
220
+ "What is the link between gender equality and climate change?",
221
+ "How much is the cost of inaction ?",
222
+ "What is the relationship between climate change and poverty?",
223
+ "What is the relationship between climate change and biodiversity loss?",
224
+ "What are the most effective strategies and technologies for reducing greenhouse gas (GHG) emissions?",
225
+ "Is economic growth possible? What do you think about degrowth?",
226
+ "Will technology save us?",
227
+ "Is climate change a natural phenomenon ?",
228
+ "Is climate change really happening or is it just a natural fluctuation in Earth's temperature?",
229
+ "Is the scientific consensus on climate change really as strong as it is claimed to be?",
230
+ "Is the impact of climate change really as severe as it is claimed to be?",
231
+ "Is climate change a hoax created by the government or environmental organizations?",
232
+ ],
233
+ [ask],
234
+ )
235
+
236
  with gr.Column(scale=1, variant="panel"):
237
  gr.Markdown("### Sources")
238
  sources_textbox = gr.Textbox(
 
257
  gr.Markdown("## How to use ClimateGPT")
258
  with gr.Row():
259
  with gr.Column(scale=1):
260
+ gr.Markdown(
261
+ """
262
  ### 💪 Getting started
263
  - In the chatbot section, simply type your climate-related question, and ClimateGPT will provide an answer with references to relevant IPCC reports.
264
  - ClimateGPT retrieves specific passages from the IPCC reports to help answer your question accurately.
 
266
  - Feel free to ask follow-up questions within the chatbot for a more in-depth understanding.
267
  - ClimateGPT integrates multiple sources (IPCC, IPBES, IEA, Limits to Growth, … ) to cover various aspects of environmental science, such as climate change, biodiversity, energy, economy, and pollution. See all sources used below.
268
  """
269
+ )
270
  with gr.Column(scale=1):
271
 
272
+ gr.Markdown(
273
+ """
274
  ### ⚠️ Limitations
275
  <div class="warning-box">
276
  <ul>
 
280
  </div>
281
  """
282
  )
283
+
284
  with gr.Row():
285
+ with gr.Column(scale=1):
286
  gr.Markdown("## 🙏 Feedback and feature requests")
287
+ gr.Markdown(
288
+ """
289
  ### Beta test
290
  - ClimateGPT welcomes community contributions. To participate, head over to the Community Tab and create a "New Discussion" to ask questions and share your insights.
291
  - Provide feedback through our feedback form, letting us know which insights you found accurate, useful, or not. Your input will help us improve the platform.
292
  - Only a few sources (see below) are integrated (all IPCC, IPBES, IEA recent reports), if you are a climate science researcher and net to sift through another report, please let us know.
293
  ### Feedbacks
294
+ """
 
 
 
 
 
 
 
295
  )
296
+ with gr.Row():
297
+ with gr.Column():
298
+ feedback = gr.Textbox(label="Write your feedback here")
299
+ with gr.Column(scale=1):
300
+ feedback_output = gr.Textbox(label="Submit status")
301
+ with gr.Row():
302
+ feedback_save = gr.Button(value="submit feedback")
303
+ feedback_save.click(
304
+ save_feedback,
305
+ inputs=[feedback, user_id_state],
306
+ outputs=feedback_output,
307
+ )
308
+ with gr.Row():
309
+ gr.Markdown(
310
+ "If you need us to ask another climate science report or ask any question, contact us at <b>theo.alvesdacosta@ekimetrics.com</b>"
311
+ )
312
 
313
+ with gr.Row():
314
+ with gr.Column(scale=1):
315
  gr.Markdown("## OpenAI API")
316
+ gr.Markdown(
317
+ "To make climate science accessible to a wider audience, we have opened our own OpenAI API key with a monthly cap of $1000. If you already have an API key, please use it to help conserve bandwidth for others."
318
+ )
319
  openai_api_key_textbox = gr.Textbox(
320
  placeholder="Paste your OpenAI API key (sk-...) and hit Enter",
321
  show_label=False,
322
  lines=1,
323
  type="password",
324
  )
325
+ openai_api_key_textbox.change(set_openai_api_key, inputs=[openai_api_key_textbox])
326
+ openai_api_key_textbox.submit(set_openai_api_key, inputs=[openai_api_key_textbox])
 
 
 
 
327
 
328
+ gr.Markdown(
329
+ """
330
 
331
 
332
  ## 📚 Sources
 
362
  This tool has been developed by the R&D lab at **Ekimetrics** (Jean Lelong, Nina Achache, Gabriel Olympie, Nicolas Chesneau, Natalia De la Calzada, Théo Alves Da Costa)
363
 
364
  If you have any questions or feature requests, please feel free to reach us out at <b>theo.alvesdacosta@ekimetrics.com</b>.
365
+ """
366
+ )
367
+
368
  demo.queue(concurrency_count=16)
369
 
370
  demo.launch()