Nina
commited on
Commit
β’
1f2a7dc
1
Parent(s):
f3d1657
Cleaning & wording
Browse files
app.py
CHANGED
@@ -26,7 +26,7 @@ def gen_conv(query: str, report_type, history=[system_template], ipcc=True):
|
|
26 |
Returns:
|
27 |
_type_: _description_
|
28 |
"""
|
29 |
-
if report_type == "
|
30 |
document_store = FAISSDocumentStore.load(
|
31 |
index_path="./documents/climate_gpt_only_giec.faiss",
|
32 |
config_path="./documents/climate_gpt_only_giec.json",
|
@@ -89,17 +89,6 @@ css_code = ".gradio-container {background-image: url('file=background.png');back
|
|
89 |
|
90 |
with gr.Blocks(title="π ClimateGPT Ekimetrics", css=css_code) as demo:
|
91 |
|
92 |
-
document_store = FAISSDocumentStore.load(
|
93 |
-
index_path="./documents/climate_gpt.faiss",
|
94 |
-
config_path="./documents/climate_gpt.json",
|
95 |
-
)
|
96 |
-
|
97 |
-
dense = EmbeddingRetriever(
|
98 |
-
document_store=document_store,
|
99 |
-
embedding_model="sentence-transformers/multi-qa-mpnet-base-dot-v1",
|
100 |
-
model_format="sentence_transformers",
|
101 |
-
)
|
102 |
-
|
103 |
openai.api_key = os.environ["api_key"]
|
104 |
gr.Markdown("### Welcome to Climate GPT π ! ")
|
105 |
gr.Markdown(
|
@@ -137,7 +126,15 @@ with gr.Blocks(title="π ClimateGPT Ekimetrics", css=css_code) as demo:
|
|
137 |
|
138 |
ask.submit(
|
139 |
fn=gen_conv,
|
140 |
-
inputs=[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
outputs=[chatbot, state, sources_textbox],
|
142 |
)
|
143 |
with gr.Accordion("Add your personal openai api key", open=False):
|
|
|
26 |
Returns:
|
27 |
_type_: _description_
|
28 |
"""
|
29 |
+
if report_type == "IPCC only":
|
30 |
document_store = FAISSDocumentStore.load(
|
31 |
index_path="./documents/climate_gpt_only_giec.faiss",
|
32 |
config_path="./documents/climate_gpt_only_giec.json",
|
|
|
89 |
|
90 |
with gr.Blocks(title="π ClimateGPT Ekimetrics", css=css_code) as demo:
|
91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
openai.api_key = os.environ["api_key"]
|
93 |
gr.Markdown("### Welcome to Climate GPT π ! ")
|
94 |
gr.Markdown(
|
|
|
126 |
|
127 |
ask.submit(
|
128 |
fn=gen_conv,
|
129 |
+
inputs=[
|
130 |
+
ask,
|
131 |
+
gr.inputs.Dropdown(
|
132 |
+
["IPCC only", "All available"],
|
133 |
+
default="All available",
|
134 |
+
label="Select reports",
|
135 |
+
),
|
136 |
+
state,
|
137 |
+
],
|
138 |
outputs=[chatbot, state, sources_textbox],
|
139 |
)
|
140 |
with gr.Accordion("Add your personal openai api key", open=False):
|