Spaces:
Runtime error
Runtime error
File size: 923 Bytes
a1b76f2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
import gradio as gr
import requests
def compute_ner(input_text_message):
endpoint_url = 'https://on1m82uknekghqeh.us-east-1.aws.endpoints.huggingface.cloud'
headers = {
'Authorization': 'Bearer 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',
'Content-Type': 'application/json',
}
json_data = {
'inputs': input_text_message,
}
response = requests.post(endpoint_url, headers=headers, json=json_data)
result = response.json()
return {"text": input_text_message, "entities": result}
examples = ['You are dick', 'My dad is an asshole and took his anger out on my mom by verbally abusing her and when she left he eventually moved on to my brother']
iface = gr.Interface(fn=compute_ner,
inputs=gr.Textbox(placeholder="Enter sentence here"),
outputs=gr.HighlightedText(),
examples=examples)
iface.launch() |