import gradio as gr import time def load_model_with_retry(model_name, max_retries=3, delay=5): for attempt in range(max_retries): try: return gr.load(f"models/{model_name}") except Exception as e: print(f"Attempt {attempt + 1} failed: {str(e)}") if attempt < max_retries - 1: print(f"Retrying in {delay} seconds...") time.sleep(delay) else: print("Max retries reached. Unable to load model.") raise try: model = load_model_with_retry("meta-llama/Meta-Llama-3.1-405B") model.launch() except Exception as e: print(f"Failed to load model: {str(e)}") print("Consider using a smaller model or checking your network connection.")