Spaces:
Sleeping
Sleeping
File size: 1,739 Bytes
74c0581 47e4aa2 352ebdd b2638ec 47e4aa2 39c71c7 352ebdd 25bd1f2 352ebdd 47e4aa2 352ebdd b2638ec 39c71c7 25bd1f2 39c71c7 25bd1f2 39c71c7 25bd1f2 39c71c7 09e4097 25bd1f2 080146c 25bd1f2 ac52d7a 39c71c7 b2638ec ac52d7a 47e4aa2 39c71c7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# app.py nuovo
import gradio as gr
import logging
from app.logging_config import configure_logging
from app.functions.database_handling import list_databases
from ui.chatbot_tab import create_chatbot_tab
from ui.db_management_tab import create_db_management_tab
from ui.document_management_tab import create_document_management_tab
from ui.info_tab import create_info_tab # Importa la nuova tab
# Configura il logging
configure_logging()
def main():
"""Funzione principale che crea e lancia l'app Gradio."""
logging.info("Avvio applicazione")
try:
with gr.Blocks() as rag_chatbot:
gr.Markdown("# Chatbot basato su RAG")
logging.info("Interfaccia Gradio inizializzata")
# Prima ottiene tutti i riferimenti
info_refs = create_info_tab()
chat_refs = create_chatbot_tab()
doc_refs = create_document_management_tab()
db_refs = create_db_management_tab # Crea la nuova tab delle informazioni
# Crea dizionario completo dei riferimenti
dropdowns = {
"document": doc_refs,
"chat": chat_refs,
"info": info_refs
}
# Crea i tab nell'ordine corretto
chat_refs # Tab 4: Chatbot (ultima tab)
doc_refs # Tab 2: Document Management
db_refs(dropdowns)
info_refs # Tab 5: Info (ultima tab)
rag_chatbot.launch()
except Exception as e:
logging.error(f"Errore durante l'avvio: {str(e)}")
if __name__ == "__main__":
main() |