import tensorflow as tf from pathlib import Path from huggingface_hub import hf_hub_download import os import keras_hub model_path = hf_hub_download( repo_id="aikenml/AI-text-humanizer-deberta", filename="deberta_classifier.keras", # token=os.getenv("HF_TOKEN") # модель публичный, токен керек емес ) # Загружаем модель (без компиляции, чтобы убрать предупреждения) model = tf.keras.models.load_model(model_path, compile=False) def debert_classifier(text): predictions = model.predict([text]) # Show results for text, pred in zip([text], predictions): # label = "AI-generated" if pred > 0.5 else "Human-written" # print(f"{text} --> {label} (score={pred[0]:.4f})") # return label # return "hello" # return 0.7 print(pred) return pred