import gradio as gr import os # Get the Hugging Face token from the environment variable hf_token = os.getenv("hf_token") if not hf_token: raise ValueError("No hf_token found in environment variables") # Load the model using the token try: interface = gr.load("models/NoaiGPT/777", api_key=hf_token) # Launch the Gradio interface interface.launch() except gradio.exceptions.ModelNotFoundError as e: print(f"Model not found: {e}") except Exception as e: print(f"An error occurred: {e}")