|
|
import gradio as gr |
|
|
from inference import inference |
|
|
import os |
|
|
|
|
|
theme = gr.themes.Soft( |
|
|
primary_hue="red", |
|
|
secondary_hue="red", |
|
|
) |
|
|
|
|
|
salute = f""" |
|
|
👋 ¡Bienvenido a Ticio! |
|
|
Ten en cuenta que la primera respuesta en cada chat puede tardar unos 30 segundos. |
|
|
Recuerda no pedir fallos específicos, sino más bien temas o áreas. |
|
|
Para más información sobre cómo sacarle el mejor provecho a Ticio, lee este artículo: {os.environ['link']} |
|
|
""" |
|
|
|
|
|
with gr.Blocks(theme=theme) as demo: |
|
|
chatbot = gr.Chatbot(type="messages", |
|
|
value=[{"role": "assistant", "content": salute}]) |
|
|
|
|
|
|
|
|
hidden_text = gr.Textbox(visible=False) |
|
|
|
|
|
|
|
|
links_table = gr.Dataframe( |
|
|
headers=["Radicado", "Link"], |
|
|
datatype=["str", "str"], |
|
|
interactive=False, |
|
|
value=[], |
|
|
render = False |
|
|
) |
|
|
|
|
|
|
|
|
gr.ChatInterface( |
|
|
fn=inference, |
|
|
chatbot=chatbot, |
|
|
type="messages", |
|
|
additional_inputs=[hidden_text, links_table], |
|
|
additional_outputs=[hidden_text, links_table], |
|
|
save_history=True, |
|
|
show_api=False, |
|
|
multimodal = True |
|
|
).render() |
|
|
|
|
|
demo.launch() |