Spaces:
Sleeping
Sleeping
File size: 1,661 Bytes
74c0581 47e4aa2 352ebdd b2638ec 47e4aa2 39c71c7 352ebdd 47e4aa2 352ebdd b2638ec 39c71c7 09e4097 39c71c7 09e4097 39c71c7 09e4097 39c71c7 09e4097 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 |
# 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.new_features_tab import create_new_features_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
chat_refs = create_chatbot_tab()
doc_refs = create_document_management_tab()
# Crea dizionario completo dei riferimenti
dropdowns = {
"document": doc_refs,
"chat": chat_refs
}
# Crea i tab nell'ordine corretto
chat_refs # Tab 4: Chatbot (ultima tab)
doc_refs # Tab 2: Document Management
create_db_management_tab(dropdowns) # Tab 1: DB Management
create_new_features_tab() # Tab 3: Features
rag_chatbot.launch()
except Exception as e:
logging.error(f"Errore durante l'avvio: {str(e)}")
if __name__ == "__main__":
main() |