Update app.py
Browse files
app.py
CHANGED
@@ -114,8 +114,8 @@ def predict(system_msg, inputs, top_p, temperature, chat_counter, chatbot=None,
|
|
114 |
for chunk in response.iter_lines():
|
115 |
if not chunk:
|
116 |
continue
|
|
|
117 |
chunk_str = chunk.decode('utf-8')
|
118 |
-
print(f"Chunk: {chunk_str}")
|
119 |
if chunk_str.startswith("data: ") and chunk_str != "data: [DONE]":
|
120 |
try:
|
121 |
chunk_data = json.loads(chunk_str[6:])
|
@@ -125,7 +125,6 @@ def predict(system_msg, inputs, top_p, temperature, chat_counter, chatbot=None,
|
|
125 |
except json.JSONDecodeError as e:
|
126 |
print(f"JSON parse hatası: {e} - Chunk: {chunk_str}")
|
127 |
elif chunk_str == "data: [DONE]":
|
128 |
-
print("Akış tamamlandı: [DONE] alındı")
|
129 |
break
|
130 |
|
131 |
# Tüm yanıt tek parça halinde eklendi
|
@@ -268,4 +267,4 @@ with gr.Blocks(css=demo_css, theme=theme) as demo:
|
|
268 |
send_button.click(reset_textbox, [], [inputs])
|
269 |
save_button.click(save_chat_and_upload, [chatbot], [save_status])
|
270 |
|
271 |
-
demo.queue(max_size=10).launch(debug=True)
|
|
|
114 |
for chunk in response.iter_lines():
|
115 |
if not chunk:
|
116 |
continue
|
117 |
+
# Chunk çıktısını artık log dosyasına eklemiyoruz, sadece son yanıtı topluyoruz.
|
118 |
chunk_str = chunk.decode('utf-8')
|
|
|
119 |
if chunk_str.startswith("data: ") and chunk_str != "data: [DONE]":
|
120 |
try:
|
121 |
chunk_data = json.loads(chunk_str[6:])
|
|
|
125 |
except json.JSONDecodeError as e:
|
126 |
print(f"JSON parse hatası: {e} - Chunk: {chunk_str}")
|
127 |
elif chunk_str == "data: [DONE]":
|
|
|
128 |
break
|
129 |
|
130 |
# Tüm yanıt tek parça halinde eklendi
|
|
|
267 |
send_button.click(reset_textbox, [], [inputs])
|
268 |
save_button.click(save_chat_and_upload, [chatbot], [save_status])
|
269 |
|
270 |
+
demo.queue(max_size=10).launch(debug=True, share=True)
|