AashitaK's picture
Update app.py
b7367c9 verified
raw
history blame contribute delete
835 Bytes
import logging
from utils.chatbot_interface import ChatbotInterface
# Configure logging to both file and console
log_file_path = "logs/chatbot.log"
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s - %(levelname)s - %(message)s",
handlers=[
logging.FileHandler(log_file_path, mode='a', encoding='utf-8'), # Save logs to a file
logging.StreamHandler() # Print logs to the console
]
)
if __name__ == "__main__":
try:
# Instantiate the ChatbotInterface class and create the interface
chatbot_interface = ChatbotInterface()
demo = chatbot_interface.create_interface()
# Launch the Gradio interface
logging.info("Launching the Gradio interface...")
demo.launch()
except Exception as e:
logging.error(f"An error occurred: {e}")