Spaces:
Runtime error
Runtime error
Jason St George
commited on
Commit
·
03d90d9
1
Parent(s):
79813dd
update2
Browse files
app.py
CHANGED
@@ -115,7 +115,7 @@ try:
|
|
115 |
with open(args.vectorstore_path, "rb") as f:
|
116 |
VECTORSTORE = pickle.load(f)
|
117 |
|
118 |
-
print("Loaded vectorstore from `{}`.".format(args.vectorstore_path))
|
119 |
|
120 |
chain = get_chain(
|
121 |
VECTORSTORE,
|
@@ -124,12 +124,12 @@ try:
|
|
124 |
prompt=args.prompt
|
125 |
)
|
126 |
|
127 |
-
print("Loaded LangChain...")
|
128 |
|
129 |
except:
|
130 |
|
131 |
VECTORSTORE = None
|
132 |
-
print("NO vectorstore loaded. Flying blind")
|
133 |
|
134 |
|
135 |
def set_prompt(prompt: str):
|
@@ -150,7 +150,7 @@ def set_prompt(prompt: str):
|
|
150 |
qa_prompt=PROMPT
|
151 |
)
|
152 |
|
153 |
-
print("PROMPT set to {}".format(prompt))
|
154 |
return chain
|
155 |
|
156 |
|
@@ -163,7 +163,7 @@ def set_vectorstore(vectorstore_path: str):
|
|
163 |
with open(vectorstore_path, "rb") as f:
|
164 |
VECTORSTORE = pickle.load(f)
|
165 |
|
166 |
-
print("Loaded `{}`".format(vectorstore_path))
|
167 |
NEW_VECTORSTORE_SET = True
|
168 |
|
169 |
chain = get_chain(
|
@@ -176,7 +176,7 @@ def set_vectorstore(vectorstore_path: str):
|
|
176 |
except:
|
177 |
VECTORSTORE = None
|
178 |
NEW_VECTORSTORE_SET = False
|
179 |
-
print("NO vectorstore loaded. Reverting to original {}".format('vectorstore.pkl'))
|
180 |
|
181 |
return chain
|
182 |
|
@@ -188,7 +188,7 @@ def initialize_chain():
|
|
188 |
max_tokens=args.max_tokens,
|
189 |
prompt=args.prompt
|
190 |
)
|
191 |
-
print("LangChain initialized!")
|
192 |
return chain
|
193 |
|
194 |
|
@@ -230,14 +230,14 @@ chat = ChatWrapper()
|
|
230 |
# block = gr.Blocks(css=".gradio-container {background-color: lightgray} .overflow-y-auto{height:500px}")
|
231 |
# block = gr.Blocks(css='body{background-image:url("https://upload.wikimedia.org/wikipedia/commons/7/7f/Mckenna1.jpg");}')
|
232 |
# css=".gradio-container {background-image: url('file=Mckenna1.jpg')}"
|
233 |
-
css=".gradio-container {background-color: lightgray} .overflow-y-auto{height:
|
234 |
block = gr.Blocks(css=css)
|
235 |
|
236 |
with block:
|
237 |
|
238 |
with gr.Row():
|
239 |
gr.Markdown("<h3><center>TerenceGPT</center></h3>")
|
240 |
-
gr.Image(type='filepath', value='McKenna3.jpg')
|
241 |
|
242 |
gr.HTML("Please initialize the chain by clicking 'Start Chain!' before submitting a question.")
|
243 |
with gr.Row():
|
|
|
115 |
with open(args.vectorstore_path, "rb") as f:
|
116 |
VECTORSTORE = pickle.load(f)
|
117 |
|
118 |
+
# print("Loaded vectorstore from `{}`.".format(args.vectorstore_path))
|
119 |
|
120 |
chain = get_chain(
|
121 |
VECTORSTORE,
|
|
|
124 |
prompt=args.prompt
|
125 |
)
|
126 |
|
127 |
+
# print("Loaded LangChain...")
|
128 |
|
129 |
except:
|
130 |
|
131 |
VECTORSTORE = None
|
132 |
+
# print("NO vectorstore loaded. Flying blind")
|
133 |
|
134 |
|
135 |
def set_prompt(prompt: str):
|
|
|
150 |
qa_prompt=PROMPT
|
151 |
)
|
152 |
|
153 |
+
# print("PROMPT set to {}".format(prompt))
|
154 |
return chain
|
155 |
|
156 |
|
|
|
163 |
with open(vectorstore_path, "rb") as f:
|
164 |
VECTORSTORE = pickle.load(f)
|
165 |
|
166 |
+
# print("Loaded `{}`".format(vectorstore_path))
|
167 |
NEW_VECTORSTORE_SET = True
|
168 |
|
169 |
chain = get_chain(
|
|
|
176 |
except:
|
177 |
VECTORSTORE = None
|
178 |
NEW_VECTORSTORE_SET = False
|
179 |
+
# print("NO vectorstore loaded. Reverting to original {}".format('vectorstore.pkl'))
|
180 |
|
181 |
return chain
|
182 |
|
|
|
188 |
max_tokens=args.max_tokens,
|
189 |
prompt=args.prompt
|
190 |
)
|
191 |
+
# print("LangChain initialized!")
|
192 |
return chain
|
193 |
|
194 |
|
|
|
230 |
# block = gr.Blocks(css=".gradio-container {background-color: lightgray} .overflow-y-auto{height:500px}")
|
231 |
# block = gr.Blocks(css='body{background-image:url("https://upload.wikimedia.org/wikipedia/commons/7/7f/Mckenna1.jpg");}')
|
232 |
# css=".gradio-container {background-image: url('file=Mckenna1.jpg')}"
|
233 |
+
css=".gradio-container {background-color: lightgray} .overflow-y-auto{height:500px}"
|
234 |
block = gr.Blocks(css=css)
|
235 |
|
236 |
with block:
|
237 |
|
238 |
with gr.Row():
|
239 |
gr.Markdown("<h3><center>TerenceGPT</center></h3>")
|
240 |
+
# gr.Image(type='filepath', value='McKenna3.jpg', shape=(200,100))
|
241 |
|
242 |
gr.HTML("Please initialize the chain by clicking 'Start Chain!' before submitting a question.")
|
243 |
with gr.Row():
|