NinaAchache
commited on
Commit
•
71ab0a8
1
Parent(s):
2983354
Correcting import
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@ from haystack.document_stores import FAISSDocumentStore
|
|
4 |
from haystack.nodes import EmbeddingRetriever
|
5 |
import numpy as np
|
6 |
import openai
|
|
|
7 |
|
8 |
document_store = FAISSDocumentStore.load(
|
9 |
index_path=f"./documents/climate_gpt.faiss",
|
@@ -22,7 +23,6 @@ dense = EmbeddingRetriever(
|
|
22 |
model_format="sentence_transformers",
|
23 |
)
|
24 |
|
25 |
-
openai.api_key=""
|
26 |
|
27 |
def is_climate_change_related(sentence: str) -> bool:
|
28 |
results = classifier(
|
@@ -89,12 +89,7 @@ def set_openai_api_key(api_key):
|
|
89 |
|
90 |
# Gradio
|
91 |
with gr.Blocks(title="Eki IPCC Explorer") as demo:
|
92 |
-
gr.Markdown(
|
93 |
-
"""
|
94 |
-
# Add your OPENAI api key First
|
95 |
-
"""
|
96 |
-
)
|
97 |
-
|
98 |
with gr.Row():
|
99 |
openai_api_key_textbox = gr.Textbox(
|
100 |
placeholder="Paste your OpenAI API key (sk-...) and hit Enter",
|
@@ -104,12 +99,7 @@ with gr.Blocks(title="Eki IPCC Explorer") as demo:
|
|
104 |
)
|
105 |
|
106 |
|
107 |
-
gr.Markdown(
|
108 |
-
"""
|
109 |
-
# Ask me anything, I'm a climate expert
|
110 |
-
"""
|
111 |
-
)
|
112 |
-
|
113 |
with gr.Row():
|
114 |
with gr.Column(scale=2):
|
115 |
chatbot = gr.Chatbot()
|
|
|
4 |
from haystack.nodes import EmbeddingRetriever
|
5 |
import numpy as np
|
6 |
import openai
|
7 |
+
import os
|
8 |
|
9 |
document_store = FAISSDocumentStore.load(
|
10 |
index_path=f"./documents/climate_gpt.faiss",
|
|
|
23 |
model_format="sentence_transformers",
|
24 |
)
|
25 |
|
|
|
26 |
|
27 |
def is_climate_change_related(sentence: str) -> bool:
|
28 |
results = classifier(
|
|
|
89 |
|
90 |
# Gradio
|
91 |
with gr.Blocks(title="Eki IPCC Explorer") as demo:
|
92 |
+
gr.Markdown("""# Add your OPENAI api key First""")
|
|
|
|
|
|
|
|
|
|
|
93 |
with gr.Row():
|
94 |
openai_api_key_textbox = gr.Textbox(
|
95 |
placeholder="Paste your OpenAI API key (sk-...) and hit Enter",
|
|
|
99 |
)
|
100 |
|
101 |
|
102 |
+
gr.Markdown("""# Ask me anything, I'm a climate expert""")
|
|
|
|
|
|
|
|
|
|
|
103 |
with gr.Row():
|
104 |
with gr.Column(scale=2):
|
105 |
chatbot = gr.Chatbot()
|