Spaces:
Sleeping
Sleeping
added text streamer
Browse files- app.py +1 -0
- backend.py +2 -1
app.py
CHANGED
@@ -12,4 +12,5 @@ iface = gr.ChatInterface(
|
|
12 |
|
13 |
|
14 |
if __name__ == "__main__":
|
|
|
15 |
iface.launch()
|
|
|
12 |
|
13 |
|
14 |
if __name__ == "__main__":
|
15 |
+
progress=gr.Progress(track_tqdm=True)
|
16 |
iface.launch()
|
backend.py
CHANGED
@@ -72,12 +72,13 @@ def handle_query(query_str, chathistory):
|
|
72 |
|
73 |
try:
|
74 |
result = index.as_query_engine(text_qa_template=text_qa_template, streaming=True).query(query_str)
|
75 |
-
response_text = result.
|
76 |
|
77 |
# Remove any unwanted tokens like <end_of_turn>
|
78 |
cleaned_result = response_text.replace("<end_of_turn>", "").strip()
|
79 |
|
80 |
yield cleaned_result
|
|
|
81 |
except Exception as e:
|
82 |
yield f"Error processing query: {str(e)}"
|
83 |
|
|
|
72 |
|
73 |
try:
|
74 |
result = index.as_query_engine(text_qa_template=text_qa_template, streaming=True).query(query_str)
|
75 |
+
response_text = result.get_response
|
76 |
|
77 |
# Remove any unwanted tokens like <end_of_turn>
|
78 |
cleaned_result = response_text.replace("<end_of_turn>", "").strip()
|
79 |
|
80 |
yield cleaned_result
|
81 |
+
|
82 |
except Exception as e:
|
83 |
yield f"Error processing query: {str(e)}"
|
84 |
|