import sys import os sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))) from huggingface_hub import InferenceClient from backend.app.config import config def verify(): print("Verifying token with gpt2...") try: client = InferenceClient(token=config.HUGGINGFACE_API_KEY) res = client.text_generation("Hello", model="gpt2") print("Success with GPT2!") print(res) except Exception as e: print(f"Failed with GPT2: {e}") if __name__ == "__main__": verify()