Spaces:
Sleeping
Sleeping
File size: 2,007 Bytes
74c0581 47e4aa2 352ebdd b2638ec 47e4aa2 3c5ed5b 352ebdd 25bd1f2 9804548 352ebdd 47e4aa2 352ebdd b2638ec 39c71c7 25bd1f2 39c71c7 25bd1f2 9804548 25bd1f2 39c71c7 25bd1f2 9804548 39c71c7 09e4097 25bd1f2 9804548 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 51 52 |
# app.py nuovo
import gradio as gr
import logging
from app.logging_config import configure_logging
from app.utils.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
from ui.chunks_viewer_tab import create_chunks_viewer_tab # Aggiungi l'import in cima al file
# 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()
chunks_refs = create_chunks_viewer_tab() # Aggiungi il nuovo 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,
"chunks": chunks_refs # Aggiungi il riferimento
}
# Crea i tab nell'ordine corretto
chat_refs # Tab 4: Chatbot (ultima tab)
doc_refs # Tab 2: Document Management
db_refs(dropdowns)
chunks_refs # Aggiungi il tab dei chunks
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() |