Update app.py
Browse files
app.py
CHANGED
|
@@ -2,25 +2,44 @@ import gradio as gr
|
|
| 2 |
from inference import inference
|
| 3 |
import os
|
| 4 |
|
| 5 |
-
theme =
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
|
| 10 |
salute = f"""
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
"""
|
| 17 |
|
| 18 |
-
with gr.Blocks(theme
|
| 19 |
chatbot = gr.Chatbot(type="messages",
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
|
|
|
| 23 |
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
demo.launch()
|
|
|
|
| 2 |
from inference import inference
|
| 3 |
import os
|
| 4 |
|
| 5 |
+
theme = gr.themes.Soft(
|
| 6 |
+
primary_hue="red",
|
| 7 |
+
secondary_hue="red",
|
| 8 |
+
)
|
| 9 |
|
| 10 |
salute = f"""
|
| 11 |
+
👋 ¡Bienvenido a Ticio!
|
| 12 |
+
Ten en cuenta que la primera respuesta en cada chat puede tardar unos 30 segundos.
|
| 13 |
+
Recuerda no pedir fallos específicos, sino más bien temas o áreas.
|
| 14 |
+
Para más información sobre cómo sacarle el mejor provecho a Ticio, lee este artículo: {os.environ['link']}
|
| 15 |
+
"""
|
|
|
|
| 16 |
|
| 17 |
+
with gr.Blocks(theme=theme) as demo:
|
| 18 |
chatbot = gr.Chatbot(type="messages",
|
| 19 |
+
value=[{"role": "assistant", "content": salute}])
|
| 20 |
+
|
| 21 |
+
# Hidden textbox
|
| 22 |
+
hidden_text = gr.Textbox(visible=False)
|
| 23 |
|
| 24 |
+
# Tabla de radicados y links
|
| 25 |
+
links_table = gr.Dataframe(
|
| 26 |
+
headers=["Radicado", "Link"],
|
| 27 |
+
datatype=["str", "str"],
|
| 28 |
+
interactive=True,
|
| 29 |
+
value=[],
|
| 30 |
+
render = False
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
# Interfaz de chat con tabla como input/output adicional
|
| 34 |
+
gr.ChatInterface(
|
| 35 |
+
fn=inference,
|
| 36 |
+
chatbot=chatbot,
|
| 37 |
+
type="messages",
|
| 38 |
+
additional_inputs=[hidden_text, links_table],
|
| 39 |
+
additional_outputs=[hidden_text, links_table],
|
| 40 |
+
save_history=True,
|
| 41 |
+
show_api=False
|
| 42 |
+
).render()
|
| 43 |
+
#links_table.render()
|
| 44 |
|
| 45 |
demo.launch()
|