updata handle trh
#23
by ismailhakki37 - opened
531 unmodified lines532533534535536537538539540541542543544545546547548549550551552553554555556557558559539560561531 unmodified lines "device": str(model.device) if model else "Unknown" }
# Hugging Face EndpointHandler classclass EndpointHandler: """Hugging Face endpoint handler class""" def __init__(self, model_dir): """Initialize the endpoint handler""" self.model_dir = model_dir print(f"EndpointHandler initialized with model_dir: {model_dir}") def __call__(self, payload): """Main endpoint function - delegates to query function""" return query(payload) def health_check(self): """Health check endpoint""" return health_check() def get_model_info(self): """Get model information""" return get_model_info()
# For backward compatibility and testingif __name__ == "__main__": print("Handler module loaded successfully!") print("This handler is now ready for Hugging Face endpoints.") print("Use the 'query' function as the main endpoint.") print("Use the 'query' function as the main endpoint.") print("Or use EndpointHandler class for Hugging Face compatibility.")handler.py+23-1