Spaces:
Sleeping
Sleeping
Update app.py
Browse filesShow or Hide the person
app.py
CHANGED
@@ -18,6 +18,12 @@ openai.api_key = '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'
|
|
18 |
def clear_chat(message, chat_history):
|
19 |
return "", []
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
def add_new_message(message,person, chat_history):
|
22 |
new_chat = []
|
23 |
|
@@ -84,7 +90,11 @@ with gr.Blocks() as demo:
|
|
84 |
</center>
|
85 |
""".format(encoded_image))
|
86 |
with gr.Row():
|
87 |
-
|
|
|
|
|
|
|
|
|
88 |
with gr.Row():
|
89 |
chatbot = gr.Chatbot( height=550) #just to fit the notebook
|
90 |
with gr.Row():
|
@@ -101,5 +111,8 @@ with gr.Blocks() as demo:
|
|
101 |
btn.click(respond, inputs=[msg,person, chatbot], outputs=[msg, chatbot])
|
102 |
msg.submit(respond, inputs=[msg, person,chatbot], outputs=[msg, chatbot]) #Press enter to submit
|
103 |
clear.click(clear_chat,inputs=[msg, chatbot], outputs=[msg, chatbot])
|
|
|
|
|
|
|
104 |
demo.queue()
|
105 |
demo.launch()
|
|
|
18 |
def clear_chat(message, chat_history):
|
19 |
return "", []
|
20 |
|
21 |
+
def hide_fn():
|
22 |
+
return gr.Textbox.update(visible=False)
|
23 |
+
|
24 |
+
def show_fn():
|
25 |
+
return gr.Textbox.update(visible=True)
|
26 |
+
|
27 |
def add_new_message(message,person, chat_history):
|
28 |
new_chat = []
|
29 |
|
|
|
90 |
</center>
|
91 |
""".format(encoded_image))
|
92 |
with gr.Row():
|
93 |
+
with gr.Column(scale=4):
|
94 |
+
person = gr.Textbox(label="Escribí el nombre del perosnaje famoso:",visible=True)
|
95 |
+
with gr.Column(scale=1):
|
96 |
+
hide_button = gr.Button(value="No mostrar")
|
97 |
+
show_button = gr.Button(value="Mostrar")
|
98 |
with gr.Row():
|
99 |
chatbot = gr.Chatbot( height=550) #just to fit the notebook
|
100 |
with gr.Row():
|
|
|
111 |
btn.click(respond, inputs=[msg,person, chatbot], outputs=[msg, chatbot])
|
112 |
msg.submit(respond, inputs=[msg, person,chatbot], outputs=[msg, chatbot]) #Press enter to submit
|
113 |
clear.click(clear_chat,inputs=[msg, chatbot], outputs=[msg, chatbot])
|
114 |
+
hide_button.click(fn=hide_fn,outputs=[person])
|
115 |
+
show_button.click(fn=show_fn,outputs=[person])
|
116 |
+
|
117 |
demo.queue()
|
118 |
demo.launch()
|