Spaces:
Sleeping
Sleeping
added text streamer
Browse files- app.py +1 -1
- backend.py +4 -3
app.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from backend import handle_query
|
2 |
import gradio as gr
|
3 |
|
4 |
|
|
|
1 |
+
from backend import handle_query
|
2 |
import gradio as gr
|
3 |
|
4 |
|
backend.py
CHANGED
@@ -83,12 +83,13 @@ def handle_query(query_str, chathistory):
|
|
83 |
# Execute the query
|
84 |
streaming_response = query_engine.query(query_str)
|
85 |
|
86 |
-
streaming_response.print_response_stream()
|
87 |
-
|
88 |
|
89 |
# Stream the response
|
|
|
90 |
for text in streaming_response.response_gen:
|
91 |
-
|
|
|
92 |
|
93 |
|
94 |
except Exception as e:
|
|
|
83 |
# Execute the query
|
84 |
streaming_response = query_engine.query(query_str)
|
85 |
|
86 |
+
#streaming_response.print_response_stream()
|
|
|
87 |
|
88 |
# Stream the response
|
89 |
+
outputs = []
|
90 |
for text in streaming_response.response_gen:
|
91 |
+
outputs.append(text)
|
92 |
+
yield "".join(outputs)
|
93 |
|
94 |
|
95 |
except Exception as e:
|