David Kagramanyan
initial
a1b76f2
raw
history blame
923 Bytes
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()