tarrasyed19472007 commited on
Commit
fce3faa
·
verified ·
1 Parent(s): 2c8b5b1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py CHANGED
@@ -67,6 +67,31 @@ if user_input:
67
  text_to_speech(chatbot_response)
68
 
69
  text_to_speech(chatbot_response)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
 
72
 
 
67
  text_to_speech(chatbot_response)
68
 
69
  text_to_speech(chatbot_response)
70
+ import logging
71
+
72
+ # Configure logging
73
+ logging.basicConfig(level=logging.INFO)
74
+
75
+ # Use logging instead of print for more structured output
76
+ def load_model():
77
+ try:
78
+ logging.info("Loading model...")
79
+ model_name = "declare-lab/tango-full"
80
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
81
+ model = AutoModelForCausalLM.from_pretrained(model_name, use_auth_token=HUGGING_FACE_API_KEY)
82
+ logging.info("Model loaded successfully.")
83
+ return model, tokenizer
84
+ except Exception as e:
85
+ logging.error(f"Error loading model: {e}")
86
+ raise
87
+
88
+ # Example usage in your Streamlit code
89
+ if __name__ == "__main__":
90
+ try:
91
+ model, tokenizer = load_model()
92
+ except Exception as e:
93
+ logging.error(f"Application failed to start: {e}")
94
+
95
 
96
 
97