Download app.py from Ticio/TicioProd: direct link, hf CLI and curl.
- Browser
- Download file 1.26 kB
-
https://huggingface.co/spaces/Ticio/TicioProd/resolve/main/app.py
- Command line
-
hf download hf://spaces/Ticio/TicioProd/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Ticio/TicioProd/resolve/main/app.py
1.26 kB
| 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 textbox | |
| hidden_text = gr.Textbox(visible=False) | |
| # Tabla de radicados y links | |
| links_table = gr.Dataframe( | |
| headers=["Radicado", "Link"], | |
| datatype=["str", "str"], | |
| interactive=False, | |
| value=[], | |
| render = False | |
| ) | |
| # Interfaz de chat con tabla como input/output adicional | |
| 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() |