Spaces:
Runtime error
Runtime error
File size: 555 Bytes
4ba4a77 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import requests
import random
import time
def func2(text):
filter = False
API_URL = "/static-proxy?url=https%3A%2F%2Fapi-inference.huggingface.co%2Fmodels%2FAbderrahim2%2Fbert-finetuned-gender_classification%26quot%3B%3C%2Fspan%3E
headers = {"Authorization": "Bearer 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"}
response = requests.post(API_URL, headers=headers, json=text)
output = response.json()
result = dict()
for out in output[0]:
label = out['label']
if label == 'undefined' and filter: continue
result[label] = out['score']
return result |