Update app.py
Browse files
app.py
CHANGED
@@ -104,7 +104,7 @@ def chat(
|
|
104 |
messages.pop()
|
105 |
else:
|
106 |
sources = "No climate science report was used to provide this answer."
|
107 |
-
complete_response = "No relevant
|
108 |
|
109 |
messages.append({"role": "assistant", "content": complete_response})
|
110 |
timestamp = str(datetime.now().timestamp())
|
@@ -172,7 +172,7 @@ with gr.Blocks(title="🌍 Climate Q&A", css="style.css") as demo:
|
|
172 |
<span class="light-bulb" role="img" aria-label="Light Bulb">💡</span>
|
173 |
How does ClimateQ&A work?
|
174 |
</div>
|
175 |
-
ClimateQ&A harnesses modern OCR techniques to parse and preprocess IPCC reports. By leveraging state-of-the-art question-answering algorithms, <i>ClimateQ&A is able to sift through the extensive collection of climate scientific reports and identify relevant passages in response to user inquiries</i>. Furthermore, the integration of the ChatGPT API allows ClimateQ&A to present complex data in a user-friendly manner, summarizing key points and facilitating communication of climate science to a wider audience. This
|
176 |
</div>
|
177 |
|
178 |
"""
|
@@ -207,6 +207,11 @@ ClimateQ&A harnesses modern OCR techniques to parse and preprocess IPCC reports.
|
|
207 |
"What is the Paris Agreement and why is it important?",
|
208 |
"Which industries have the highest GHG emissions?",
|
209 |
"Is climate change caused by humans?",
|
|
|
|
|
|
|
|
|
|
|
210 |
"What are the different greenhouse gases (GHG)?",
|
211 |
"What is the warming power of methane?",
|
212 |
"What is the jet stream?",
|
@@ -215,23 +220,18 @@ ClimateQ&A harnesses modern OCR techniques to parse and preprocess IPCC reports.
|
|
215 |
"What is the impact of global warming on ocean currents?",
|
216 |
"How much warming is possible in 2050?",
|
217 |
"What is the impact of climate change in Africa?",
|
218 |
-
"What is the impact of rising sea levels?",
|
219 |
"Will climate change accelerate diseases and epidemics like COVID?",
|
220 |
"What are the economic impacts of climate change?",
|
221 |
-
"What is the link between gender equality and climate change?",
|
222 |
"How much is the cost of inaction ?",
|
223 |
"What is the relationship between climate change and poverty?",
|
224 |
-
"What is the relationship between climate change and biodiversity loss?",
|
225 |
"What are the most effective strategies and technologies for reducing greenhouse gas (GHG) emissions?",
|
226 |
"Is economic growth possible? What do you think about degrowth?",
|
227 |
"Will technology save us?",
|
228 |
"Is climate change a natural phenomenon ?",
|
229 |
"Is climate change really happening or is it just a natural fluctuation in Earth's temperature?",
|
230 |
"Is the scientific consensus on climate change really as strong as it is claimed to be?",
|
231 |
-
"Is the impact of climate change really as severe as it is claimed to be?",
|
232 |
-
"Is climate change a hoax created by the government or environmental organizations?",
|
233 |
],
|
234 |
-
[ask_examples_hidden],
|
235 |
)
|
236 |
|
237 |
with gr.Column(scale=1, variant="panel"):
|
@@ -365,13 +365,24 @@ Carbon emissions were measured during the development and inference process usin
|
|
365 |
| --- | --- | --- | --- |
|
366 |
| Development | OCR and parsing all pdf documents with AI | 28gCO2e | CodeCarbon |
|
367 |
| Development | Question Answering development | 114gCO2e | CodeCarbon |
|
368 |
-
| Inference | Question Answering |
|
369 |
-
| Inference | API call to turbo-GPT | 0.38gCO2e / call |
|
|
|
|
|
370 |
|
371 |
## 📧 Contact
|
372 |
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)
|
373 |
|
374 |
If you have any questions or feature requests, please feel free to reach us out at <b>theo.alvesdacosta@ekimetrics.com</b>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
375 |
"""
|
376 |
)
|
377 |
|
|
|
104 |
messages.pop()
|
105 |
else:
|
106 |
sources = "No climate science report was used to provide this answer."
|
107 |
+
complete_response = "**No relevant passages found in the climate science reports, for a sourced answer you may want to try a more specific question (specifying your question on climate issues). The answer below will be tailored about climate change, but not sourced on the IPCC, please take the following results with caution.**.\n\n"
|
108 |
|
109 |
messages.append({"role": "assistant", "content": complete_response})
|
110 |
timestamp = str(datetime.now().timestamp())
|
|
|
172 |
<span class="light-bulb" role="img" aria-label="Light Bulb">💡</span>
|
173 |
How does ClimateQ&A work?
|
174 |
</div>
|
175 |
+
ClimateQ&A harnesses modern OCR techniques to parse and preprocess IPCC reports. By leveraging state-of-the-art question-answering algorithms, <i>ClimateQ&A is able to sift through the extensive collection of climate scientific reports and identify relevant passages in response to user inquiries</i>. Furthermore, the integration of the ChatGPT API allows ClimateQ&A to present complex data in a user-friendly manner, summarizing key points and facilitating communication of climate science to a wider audience. This tool effectively puts a climate expert in your pocket.
|
176 |
</div>
|
177 |
|
178 |
"""
|
|
|
207 |
"What is the Paris Agreement and why is it important?",
|
208 |
"Which industries have the highest GHG emissions?",
|
209 |
"Is climate change caused by humans?",
|
210 |
+
"Is climate change a hoax created by the government or environmental organizations?",
|
211 |
+
"What is the relationship between climate change and biodiversity loss?",
|
212 |
+
"What is the link between gender equality and climate change?",
|
213 |
+
"Is the impact of climate change really as severe as it is claimed to be?",
|
214 |
+
"What is the impact of rising sea levels?",
|
215 |
"What are the different greenhouse gases (GHG)?",
|
216 |
"What is the warming power of methane?",
|
217 |
"What is the jet stream?",
|
|
|
220 |
"What is the impact of global warming on ocean currents?",
|
221 |
"How much warming is possible in 2050?",
|
222 |
"What is the impact of climate change in Africa?",
|
|
|
223 |
"Will climate change accelerate diseases and epidemics like COVID?",
|
224 |
"What are the economic impacts of climate change?",
|
|
|
225 |
"How much is the cost of inaction ?",
|
226 |
"What is the relationship between climate change and poverty?",
|
|
|
227 |
"What are the most effective strategies and technologies for reducing greenhouse gas (GHG) emissions?",
|
228 |
"Is economic growth possible? What do you think about degrowth?",
|
229 |
"Will technology save us?",
|
230 |
"Is climate change a natural phenomenon ?",
|
231 |
"Is climate change really happening or is it just a natural fluctuation in Earth's temperature?",
|
232 |
"Is the scientific consensus on climate change really as strong as it is claimed to be?",
|
|
|
|
|
233 |
],
|
234 |
+
[ask_examples_hidden],examples_per_page = 15,
|
235 |
)
|
236 |
|
237 |
with gr.Column(scale=1, variant="panel"):
|
|
|
365 |
| --- | --- | --- | --- |
|
366 |
| Development | OCR and parsing all pdf documents with AI | 28gCO2e | CodeCarbon |
|
367 |
| Development | Question Answering development | 114gCO2e | CodeCarbon |
|
368 |
+
| Inference | Question Answering | ~0.102gCO2e / call | CodeCarbon |
|
369 |
+
| Inference | API call to turbo-GPT | ~0.38gCO2e / call | https://medium.com/@chrispointon/the-carbon-footprint-of-chatgpt-e1bc14e4cc2a |
|
370 |
+
|
371 |
+
Carbon Emissions are **relatively low but not negligible** compared to other usages: one question asked to ClimateQ&A is around 0.482gCO2e - equivalent to 2.2m by car (https://datagir.ademe.fr/apps/impact-co2/)
|
372 |
|
373 |
## 📧 Contact
|
374 |
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)
|
375 |
|
376 |
If you have any questions or feature requests, please feel free to reach us out at <b>theo.alvesdacosta@ekimetrics.com</b>.
|
377 |
+
|
378 |
+
## 💻 Developers
|
379 |
+
For developers, the methodology used is detailed below :
|
380 |
+
- Extract individual paragraphs from scientific reports (e.g., IPCC, IPBES) using OCR techniques and open sources algorithms
|
381 |
+
- Use Haystack to compute semantically representative embeddings for each paragraph using a sentence transformers model (https://huggingface.co/sentence-transformers/multi-qa-mpnet-base-dot-v1).
|
382 |
+
- Store all the embeddings in a FAISS Flat index.
|
383 |
+
- Reformulate each user query to be as specific as possible and compute its embedding.
|
384 |
+
- Retrieve up to 10 semantically closest paragraphs (using dot product similarity) from all available scientific reports.
|
385 |
+
- Provide these paragraphs as context for GPT-Turbo's answer in a system message.
|
386 |
"""
|
387 |
)
|
388 |
|