Spaces:
Running
Running
Update app.py
Browse filesdisabled speak dialog vis controlled by output window change event
app.py
CHANGED
|
@@ -556,11 +556,11 @@ def pause_message():
|
|
| 556 |
# return speak_file
|
| 557 |
|
| 558 |
|
| 559 |
-
def set_speak_button(txt):
|
| 560 |
-
|
| 561 |
-
|
| 562 |
-
|
| 563 |
-
|
| 564 |
|
| 565 |
def update_user(user_win):
|
| 566 |
user_win = user_win.lower().strip()
|
|
@@ -796,7 +796,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 796 |
pass
|
| 797 |
for s,x in abbrevs.items():
|
| 798 |
txt = txt.replace(s, x)
|
| 799 |
-
words_in = txt.replace('**', '').
|
| 800 |
words_out = []
|
| 801 |
for s in words_in:
|
| 802 |
s = s.lstrip('- *@#$%^&_=+-')
|
|
@@ -899,9 +899,10 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 899 |
button_do_image = gr.Button(value='Make Image')
|
| 900 |
button_get_image = gr.Button(value='Upload Image to Analyze')
|
| 901 |
submit_button = gr.Button(value="Submit Prompt/Question")
|
| 902 |
-
speak_output = gr.Button(value="Speak Dialog", visible=
|
| 903 |
prompt_window = gr.Textbox(label = "Prompt or Question")
|
| 904 |
-
|
|
|
|
| 905 |
with gr.Row():
|
| 906 |
with gr.Column():
|
| 907 |
image_window2 = gr.Image(visible=False, interactive=True, label='Image to Analyze', type='filepath')
|
|
@@ -921,7 +922,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 921 |
audio_out = gr.Audio(autoplay=True, visible=False)
|
| 922 |
audio_out.stop(fn=gen_output_audio, inputs=[q, user_window], outputs = [audio_out, q])
|
| 923 |
speak_output.click(fn=initial_audio_output, inputs=[output_window, user_window], outputs=[audio_out, q])
|
| 924 |
-
output_window.change(fn=set_speak_button, inputs=output_window,outputs=speak_output)
|
| 925 |
button_do_image.click(fn=make_image, inputs=[prompt_window,user_window, password],outputs=[image_window, output_window])
|
| 926 |
image_window.change(fn=delete_image, inputs=[user])
|
| 927 |
help_button.click(fn=show_help, outputs=output_window)
|
|
|
|
| 556 |
# return speak_file
|
| 557 |
|
| 558 |
|
| 559 |
+
# def set_speak_button(txt):
|
| 560 |
+
# vis = False
|
| 561 |
+
# if txt and len(txt) > 2:
|
| 562 |
+
# vis = True
|
| 563 |
+
# return gr.Button(visible=vis)
|
| 564 |
|
| 565 |
def update_user(user_win):
|
| 566 |
user_win = user_win.lower().strip()
|
|
|
|
| 796 |
pass
|
| 797 |
for s,x in abbrevs.items():
|
| 798 |
txt = txt.replace(s, x)
|
| 799 |
+
words_in = txt.replace('**', '').replace(' ','').split('<br>')
|
| 800 |
words_out = []
|
| 801 |
for s in words_in:
|
| 802 |
s = s.lstrip('- *@#$%^&_=+-')
|
|
|
|
| 899 |
button_do_image = gr.Button(value='Make Image')
|
| 900 |
button_get_image = gr.Button(value='Upload Image to Analyze')
|
| 901 |
submit_button = gr.Button(value="Submit Prompt/Question")
|
| 902 |
+
speak_output = gr.Button(value="Speak Dialog", visible=True)
|
| 903 |
prompt_window = gr.Textbox(label = "Prompt or Question")
|
| 904 |
+
gr.Markdown('### **Dialog:**')
|
| 905 |
+
output_window = gr.Markdown(container=True)
|
| 906 |
with gr.Row():
|
| 907 |
with gr.Column():
|
| 908 |
image_window2 = gr.Image(visible=False, interactive=True, label='Image to Analyze', type='filepath')
|
|
|
|
| 922 |
audio_out = gr.Audio(autoplay=True, visible=False)
|
| 923 |
audio_out.stop(fn=gen_output_audio, inputs=[q, user_window], outputs = [audio_out, q])
|
| 924 |
speak_output.click(fn=initial_audio_output, inputs=[output_window, user_window], outputs=[audio_out, q])
|
| 925 |
+
# output_window.change(fn=set_speak_button, inputs=output_window,outputs=speak_output)
|
| 926 |
button_do_image.click(fn=make_image, inputs=[prompt_window,user_window, password],outputs=[image_window, output_window])
|
| 927 |
image_window.change(fn=delete_image, inputs=[user])
|
| 928 |
help_button.click(fn=show_help, outputs=output_window)
|