Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -49,14 +49,31 @@ cfg = OmegaConf.create({
|
|
49 |
})
|
50 |
|
51 |
cfg.description = f'''
|
52 |
-
<
|
53 |
'''
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
def random_fun(message, history):
|
56 |
return message + '!'
|
57 |
|
58 |
|
59 |
-
demo = gr.ChatInterface(
|
60 |
|
61 |
"""
|
62 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
|
|
49 |
})
|
50 |
|
51 |
cfg.description = f'''
|
52 |
+
<h4 style="text-align: center;">{cfg.description}</h4>
|
53 |
'''
|
54 |
|
55 |
+
vq = VectaraQuery(cfg.api_key, cgf.customer_id, cfg.corpus_ids, cfg.prompt_name)
|
56 |
+
|
57 |
+
|
58 |
+
def respond(message, history):
|
59 |
+
if cfg.streaming:
|
60 |
+
# Call stream response and stream output
|
61 |
+
stream = vq.submit_query_streaming(message)
|
62 |
+
|
63 |
+
outputs = ""
|
64 |
+
for output in stream:
|
65 |
+
outputs += output
|
66 |
+
yield outputs
|
67 |
+
else:
|
68 |
+
# Call non-stream response and return message output
|
69 |
+
response = vq.submit_query(message)
|
70 |
+
return response
|
71 |
+
|
72 |
def random_fun(message, history):
|
73 |
return message + '!'
|
74 |
|
75 |
|
76 |
+
demo = gr.ChatInterface(respond, title = cfg.title, description = cfg.description)
|
77 |
|
78 |
"""
|
79 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|