Nina
commited on
Commit
β’
19a9d09
1
Parent(s):
af9539a
Correct ux design
Browse files
app.py
CHANGED
@@ -8,7 +8,12 @@ import os
|
|
8 |
from datasets import load_dataset
|
9 |
from datasets import Dataset
|
10 |
import time
|
11 |
-
from utils import
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
|
14 |
classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli")
|
@@ -91,22 +96,18 @@ with gr.Blocks(title="π ClimateGPT Ekimetrics", css=css_code) as demo:
|
|
91 |
|
92 |
openai.api_key = os.environ["api_key"]
|
93 |
|
|
|
|
|
94 |
with gr.Tab("App"):
|
95 |
-
gr.Markdown("### Welcome to Climate GPT π ! ")
|
96 |
gr.Markdown(
|
97 |
"""
|
|
|
|
|
98 |
Climate GPT is an interactive exploration tool designed to help you easily find relevant information based on of Environmental reports such as IPCCs and other environmental reports.
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
)
|
103 |
-
gr.Markdown(
|
104 |
-
"**How does it work:** This Chatbot is a combination of two technologies. FAISS search applied to a vast amount of scientific climate reports and TurboGPT to generate human-like text from the part of the document extracted from the database."
|
105 |
-
)
|
106 |
-
gr.Markdown(
|
107 |
-
"β οΈ Warning: Always refer to the source (on the right side) to ensure the validity of the information communicated."
|
108 |
)
|
109 |
-
# gr.Markdown("""### Ask me anything, I'm a climate expert""")
|
110 |
with gr.Row():
|
111 |
with gr.Column(scale=2):
|
112 |
chatbot = gr.Chatbot()
|
@@ -139,7 +140,10 @@ with gr.Blocks(title="π ClimateGPT Ekimetrics", css=css_code) as demo:
|
|
139 |
],
|
140 |
outputs=[chatbot, state, sources_textbox],
|
141 |
)
|
142 |
-
with gr.Accordion("
|
|
|
|
|
|
|
143 |
openai_api_key_textbox = gr.Textbox(
|
144 |
placeholder="Paste your OpenAI API key (sk-...) and hit Enter",
|
145 |
show_label=False,
|
@@ -154,5 +158,30 @@ with gr.Blocks(title="π ClimateGPT Ekimetrics", css=css_code) as demo:
|
|
154 |
)
|
155 |
|
156 |
with gr.Tab("Information"):
|
157 |
-
gr.Markdown(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
demo.launch()
|
|
|
8 |
from datasets import load_dataset
|
9 |
from datasets import Dataset
|
10 |
import time
|
11 |
+
from utils import (
|
12 |
+
is_climate_change_related,
|
13 |
+
make_pairs,
|
14 |
+
set_openai_api_key,
|
15 |
+
get_random_string,
|
16 |
+
)
|
17 |
|
18 |
|
19 |
classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli")
|
|
|
96 |
|
97 |
openai.api_key = os.environ["api_key"]
|
98 |
|
99 |
+
user_id = gr.State([get_random_string(10)])
|
100 |
+
|
101 |
with gr.Tab("App"):
|
|
|
102 |
gr.Markdown(
|
103 |
"""
|
104 |
+
### Welcome to Climate GPT π !
|
105 |
+
\n
|
106 |
Climate GPT is an interactive exploration tool designed to help you easily find relevant information based on of Environmental reports such as IPCCs and other environmental reports.
|
107 |
+
\n **How does it work:** This Chatbot is a combination of two technologies. FAISS search applied to a vast amount of scientific climate reports and TurboGPT to generate human-like text from the part of the document extracted from the database.
|
108 |
+
\n β οΈ Warning: Always refer to the source to ensure the validity of the information communicated.
|
109 |
+
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
)
|
|
|
111 |
with gr.Row():
|
112 |
with gr.Column(scale=2):
|
113 |
chatbot = gr.Chatbot()
|
|
|
140 |
],
|
141 |
outputs=[chatbot, state, sources_textbox],
|
142 |
)
|
143 |
+
with gr.Accordion("Feedbacks", open=False):
|
144 |
+
gr.Markdown("Please complete some feedbacks π")
|
145 |
+
|
146 |
+
with gr.Accordion("Add your personal openai api key - Option", open=False):
|
147 |
openai_api_key_textbox = gr.Textbox(
|
148 |
placeholder="Paste your OpenAI API key (sk-...) and hit Enter",
|
149 |
show_label=False,
|
|
|
158 |
)
|
159 |
|
160 |
with gr.Tab("Information"):
|
161 |
+
gr.Markdown(
|
162 |
+
"""
|
163 |
+
## π Reports used : \n
|
164 |
+
- First Assessment Report on the Physical Science of Climate Change
|
165 |
+
- Second assessment Report on Climate Change Adaptation
|
166 |
+
- Third Assessment Report on Climate Change Mitigation
|
167 |
+
- Food Outlook Biannual Report on Global Food Markets
|
168 |
+
- IEA's report on the Role of Critical Minerals in Clean Energy Transitions
|
169 |
+
- Limits to Growth
|
170 |
+
- Outside The Safe operating system of the Planetary Boundary for Novel Entities
|
171 |
+
- Planetary Boundaries Guiding
|
172 |
+
- State of the Oceans report
|
173 |
+
- Word Energy Outlook 2021
|
174 |
+
- Word Energy Outlook 2022
|
175 |
+
- The environmental impacts of plastics and micro plastics use, waste and polution ET=U and national measures
|
176 |
+
- IPBES Global report - MArch 2022
|
177 |
+
|
178 |
+
\n
|
179 |
+
IPCC is a United Nations body that assesses the science related to climate change, including its impacts and possible response options.
|
180 |
+
The IPCC is considered the leading scientific authority on all things related to global climate change.
|
181 |
+
|
182 |
+
"""
|
183 |
+
)
|
184 |
+
with gr.Tab("Examples"):
|
185 |
+
gr.Markdown("See here some examples on how to use the Chatbot")
|
186 |
+
|
187 |
demo.launch()
|