Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -194,7 +194,18 @@ def get_answer_ai_stream(text):
|
|
| 194 |
|
| 195 |
|
| 196 |
def t2t(text):
|
|
|
|
| 197 |
return get_answer_ai(text)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 198 |
import gradio as gr
|
| 199 |
import os
|
| 200 |
import plotly.express as px
|
|
@@ -347,6 +358,11 @@ with gr.Blocks() as demo: # Use gr.Blocks to wrap the entire interface
|
|
| 347 |
text_inputk = gr.Textbox(label="أدخل النص هنا")
|
| 348 |
text_out = gr.Textbox()
|
| 349 |
text_inputk.submit(t2t, [text_inputk], [text_out])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 350 |
|
| 351 |
|
| 352 |
|
|
|
|
| 194 |
|
| 195 |
|
| 196 |
def t2t(text):
|
| 197 |
+
|
| 198 |
return get_answer_ai(text)
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
|
| 202 |
+
def t2tstream(text):
|
| 203 |
+
response=get_answer_ai_stream(text)
|
| 204 |
+
for chk in response:
|
| 205 |
+
yield chk.text
|
| 206 |
+
|
| 207 |
+
|
| 208 |
+
#return get_answer_ai(text)
|
| 209 |
import gradio as gr
|
| 210 |
import os
|
| 211 |
import plotly.express as px
|
|
|
|
| 358 |
text_inputk = gr.Textbox(label="أدخل النص هنا")
|
| 359 |
text_out = gr.Textbox()
|
| 360 |
text_inputk.submit(t2t, [text_inputk], [text_out])
|
| 361 |
+
with gr.Tab("T2TSTREAM "):
|
| 362 |
+
gr.Markdown("## T2TSTREAM ")
|
| 363 |
+
text_inputk2 = gr.Textbox(label="أدخل النص هنا")
|
| 364 |
+
text_out1 = gr.Textbox()
|
| 365 |
+
text_inputk2.submit(t2tstream, [text_inputk2], [text_out1])
|
| 366 |
|
| 367 |
|
| 368 |
|