Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,10 @@ from query import VectaraQuery
|
|
3 |
import os
|
4 |
import gradio as gr
|
5 |
|
|
|
|
|
|
|
|
|
6 |
def isTrue(x) -> bool:
|
7 |
if isinstance(x, bool):
|
8 |
return x
|
@@ -24,6 +28,7 @@ cfg = OmegaConf.create({
|
|
24 |
vq = VectaraQuery(cfg.api_key, cfg.customer_id, cfg.corpus_ids, cfg.prompt_name)
|
25 |
|
26 |
def respond(message, history):
|
|
|
27 |
if cfg.streaming:
|
28 |
# Call stream response and stream output
|
29 |
stream = vq.submit_query_streaming(message)
|
@@ -34,8 +39,10 @@ def respond(message, history):
|
|
34 |
outputs += output
|
35 |
yield outputs
|
36 |
else:
|
|
|
37 |
# Call non-stream response and return message output
|
38 |
response = vq.submit_query(message)
|
|
|
39 |
yield response
|
40 |
|
41 |
|
|
|
3 |
import os
|
4 |
import gradio as gr
|
5 |
|
6 |
+
import logging
|
7 |
+
logging.basicConfig(level=logging.DEBUG) # Set the logging level to DEBUG or INFO
|
8 |
+
|
9 |
+
|
10 |
def isTrue(x) -> bool:
|
11 |
if isinstance(x, bool):
|
12 |
return x
|
|
|
28 |
vq = VectaraQuery(cfg.api_key, cfg.customer_id, cfg.corpus_ids, cfg.prompt_name)
|
29 |
|
30 |
def respond(message, history):
|
31 |
+
logging.debug(f"Calling respond function with message {message}")
|
32 |
if cfg.streaming:
|
33 |
# Call stream response and stream output
|
34 |
stream = vq.submit_query_streaming(message)
|
|
|
39 |
outputs += output
|
40 |
yield outputs
|
41 |
else:
|
42 |
+
logging.debug("Calling non-stream response")
|
43 |
# Call non-stream response and return message output
|
44 |
response = vq.submit_query(message)
|
45 |
+
logging.debug(f"Received response: {response}")
|
46 |
yield response
|
47 |
|
48 |
|