Vertical.ai / backend /scripts /test_gpt2_client.py
Abhisingh-18's picture
Mirror of github.com/Abhisingh18/Vertical.ai
1f7ead8 verified
Raw
History Blame Contribute Delete
569 Bytes
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_gpt2():
print("Verifying GPT2...")
try:
client = InferenceClient(token=config.HUGGINGFACE_API_KEY)
res = client.text_generation("Hello", model="gpt2", max_new_tokens=10)
print("Success!")
print(res)
except Exception as e:
print(f"Failed: {repr(e)}")
if __name__ == "__main__":
verify_gpt2()