Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,7 @@ ANS_LONG = "Detallada"
|
|
15 |
def chat(user_message, history, state, long_or_short):
|
16 |
if (state is None) or (not state['user']):
|
17 |
gr.Warning("You need to authenticate first")
|
18 |
-
yield
|
19 |
else:
|
20 |
thread = state['thread']
|
21 |
if thread is None:
|
@@ -56,7 +56,7 @@ def chat(user_message, history, state, long_or_short):
|
|
56 |
def chat_nostream(user_message, history, state):
|
57 |
if (state is None) or (not state['user']):
|
58 |
gr.Warning("You need to authenticate first")
|
59 |
-
yield
|
60 |
else:
|
61 |
thread = state['thread']
|
62 |
if thread is None:
|
@@ -117,16 +117,22 @@ AUTH_JS = """function auth_js(token, state) {
|
|
117 |
}
|
118 |
"""
|
119 |
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
|
121 |
with gr.Blocks(
|
122 |
title="Dr. Luis Chiozza - Medicina y Psicoanalisis",
|
123 |
-
fill_height=True,
|
124 |
-
theme=
|
125 |
state = new_state()
|
126 |
|
127 |
gr.HTML("""
|
128 |
<h1>Dr. Luis Chiozza - Medicina y Psicoanalisis</h1>
|
129 |
-
<p>Habla con la colección de Medicina y Psicoanalisis del Dr. Luis Chiozza</p>
|
130 |
""")
|
131 |
with gr.Row(variant="compact"):
|
132 |
gr.HTML("Largo de la respuesta")
|
@@ -140,11 +146,17 @@ with gr.Blocks(
|
|
140 |
|
141 |
gr.ChatInterface(
|
142 |
chat,
|
|
|
143 |
additional_inputs=[state, long_or_short],
|
144 |
examples=[
|
145 |
["Qué diferencias hay entre el cuerpo y el Alma?"],
|
146 |
["Cuáles son las distintas funciones de los órganos del cuerpo y su relación con el alma?"],
|
147 |
],
|
|
|
|
|
|
|
|
|
|
|
148 |
)
|
149 |
|
150 |
token = gr.Textbox(visible=False)
|
|
|
15 |
def chat(user_message, history, state, long_or_short):
|
16 |
if (state is None) or (not state['user']):
|
17 |
gr.Warning("You need to authenticate first")
|
18 |
+
yield "You need to authenticate first"
|
19 |
else:
|
20 |
thread = state['thread']
|
21 |
if thread is None:
|
|
|
56 |
def chat_nostream(user_message, history, state):
|
57 |
if (state is None) or (not state['user']):
|
58 |
gr.Warning("You need to authenticate first")
|
59 |
+
yield "You need to authenticate first"
|
60 |
else:
|
61 |
thread = state['thread']
|
62 |
if thread is None:
|
|
|
117 |
}
|
118 |
"""
|
119 |
|
120 |
+
theme = gr.Theme.from_hub("freddyaboulton/[email protected]")
|
121 |
+
theme.set(
|
122 |
+
color_accent_soft="#818eb6", # ChatBot.svelte / .message-row.panel.user-row
|
123 |
+
background_fill_secondary="#6272a4", # ChatBot.svelte / .message-row.panel.bot-row
|
124 |
+
button_primary_text_color="*button_secondary_text_color",
|
125 |
+
button_primary_background_fill="*button_secondary_background_fill")
|
126 |
|
127 |
with gr.Blocks(
|
128 |
title="Dr. Luis Chiozza - Medicina y Psicoanalisis",
|
129 |
+
fill_height=True,
|
130 |
+
theme=theme) as demo:
|
131 |
state = new_state()
|
132 |
|
133 |
gr.HTML("""
|
134 |
<h1>Dr. Luis Chiozza - Medicina y Psicoanalisis</h1>
|
135 |
+
<p>Habla con la colección de Libros de Medicina y Psicoanalisis del Dr. Luis Chiozza</p>
|
136 |
""")
|
137 |
with gr.Row(variant="compact"):
|
138 |
gr.HTML("Largo de la respuesta")
|
|
|
146 |
|
147 |
gr.ChatInterface(
|
148 |
chat,
|
149 |
+
chatbot=gr.Chatbot(show_label=False, render=False, layout = "panel"),
|
150 |
additional_inputs=[state, long_or_short],
|
151 |
examples=[
|
152 |
["Qué diferencias hay entre el cuerpo y el Alma?"],
|
153 |
["Cuáles son las distintas funciones de los órganos del cuerpo y su relación con el alma?"],
|
154 |
],
|
155 |
+
submit_btn="Enviar",
|
156 |
+
stop_btn="Detener",
|
157 |
+
undo_btn=None,
|
158 |
+
clear_btn="Borrar",
|
159 |
+
retry_btn=None
|
160 |
)
|
161 |
|
162 |
token = gr.Textbox(visible=False)
|