Spaces:
Sleeping
Sleeping
from transformers import TFBertForSequenceClassification, BertTokenizer | |
from flask import Flask, request, jsonify | |
import os | |
app = Flask(__name__) | |
# Load model and tokenizer from Hugging Face Hub | |
model_name = "Erfan11/Neuracraft" | |
model = TFBertForSequenceClassification.from_pretrained(model_name, use_auth_token="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") | |
tokenizer = BertTokenizer.from_pretrained(model_name, use_auth_token="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") | |
def predict(): | |
data = request.get_json() | |
inputs = tokenizer(data["text"], return_tensors="tf") | |
outputs = model(**inputs) | |
# Process your model's output as needed | |
return jsonify(outputs) | |
if __name__ == '__main__': | |
app.run(debug=True) |