Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -174,6 +174,25 @@ def get_answer_ai(text):
|
|
174 |
response = AI.send_message(text)
|
175 |
return response.text
|
176 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
def t2t(text):
|
178 |
return get_answer_ai(text)
|
179 |
import gradio as gr
|
|
|
174 |
response = AI.send_message(text)
|
175 |
return response.text
|
176 |
|
177 |
+
|
178 |
+
|
179 |
+
def get_answer_ai_stream(text):
|
180 |
+
#if session_ai is None:
|
181 |
+
global AI
|
182 |
+
|
183 |
+
try:
|
184 |
+
|
185 |
+
response = AI.send_message(text,stream=True)
|
186 |
+
return response
|
187 |
+
|
188 |
+
|
189 |
+
except :
|
190 |
+
AI=create_chat_session()
|
191 |
+
response = AI.send_message(text,stream=True)
|
192 |
+
return response
|
193 |
+
|
194 |
+
|
195 |
+
|
196 |
def t2t(text):
|
197 |
return get_answer_ai(text)
|
198 |
import gradio as gr
|