Repository: gradio-app/gradio
Pull request: highlightedtext throws an error basing on model
## Description

It closes an issue , highlightext fails with an error reported in Issue 5029 , as the model output entity key name is different , fixed to accept both entity and entity_group, not sure if there are any other possibilities. 

Closes: #5029 

## 🎯 PRs Should Target Issues

Before your create a PR, please check to see if there is [an existing issue](https://github.com/gradio-app/gradio/issues) for this change. If not, please create an issue before you create this PR, unless the fix is very small. 

Not adhering to this guideline will result in the PR being closed. 

## Tests

1. PRs will only be merged if tests pass on CI. To run the tests locally, please set up [your Gradio environment locally](https://github.com/gradio-app/gradio/blob/main/CONTRIBUTING.md) and run the tests: `bash scripts/run_all_tests.sh`

2. You may need to run the linters: `bash scripts/format_backend.sh` and `bash scripts/format_frontend.sh`
  


Problem statement:
Gradio Highlittext method not working
### Describe the bug

I am using, 
gradio==3.39.0
gradio_client==0.3.0
i get following error , 
gradio with ner events fails with this error, highlighted_text.py", line 162, in postprocess (text[entity[“start”] : entity[“end”]], entity[“entity”]) keyerror: ‘entity’

I think the issue is with the key "entity" where output of the model is giving "entity_group"




### Have you searched existing issues?  🔎

- [X] I have searched and found no existing issues

### Reproduction

Code that i have tried, which calls highlight in output
```
demo = gr.Interface(fn=ner,
                    inputs=[gr.Textbox(label="Text to find entities", lines=2)],
                    outputs=["highlight"],
                    title="NER with dslim/bert-base-NER",
                    description="Find entities using the `dslim/bert-base-NER` model under the hood!",
                    allow_flagging="never",
                    #Here we introduce a new tag, examples, easy to use examples for your application
                    examples=["My name is Andrew and I live in California", "My name is Poli and work at HuggingFace"])
demo.launch(share=True, server_port=7862)
```

Code in 162 line of highlighted_text.py
```
list_format.append(
                        (text[entity["start"] : entity["end"]], entity["entity"])
                    )
```

### Screenshot

_No response_

### Logs

```shell
gradio with ner events fails with this error, highlighted_text.py", line 162, in postprocess (text[entity[“start”] : entity[“end”]], entity[“entity”]) keyerror: ‘entity’
not the complete error log
```


### System Info

```shell
MacBook Pro , M1 chip
```


### Severity

I can work around it

Hints from issue discussion:

Commit message: highlightedtext throws an error basing on model

Patch to review:
diff --git a/gradio/components/highlighted_text.py b/gradio/components/highlighted_text.py
index 8d8c9b0d0b..37686e262a 100644
--- a/gradio/components/highlighted_text.py
+++ b/gradio/components/highlighted_text.py
@@ -158,8 +158,9 @@ def postprocess(
                 entities = sorted(entities, key=lambda x: x["start"])
                 for entity in entities:
                     list_format.append((text[index : entity["start"]], None))
+                    entity_group = "entity_group" if "entity_group" in entity else "entity"
                     list_format.append(
-                        (text[entity["start"] : entity["end"]], entity["entity"])
+                        (text[entity["start"] : entity["end"]], entity_group)
                     )
                     index = entity["end"]
                 list_format.append((text[index:], None))


Code review comments:
diff_hunk: @@ -158,8 +158,9 @@ def postprocess(
                 entities = sorted(entities, key=lambda x: x["start"])
                 for entity in entities:
                     list_format.append((text[index : entity["start"]], None))
+                    entity_group = "entity_group" if "entity_group" in entity else "entity"
                     list_format.append(
-                        (text[entity["start"] : entity["end"]], entity["entity"])
+                        (text[entity["start"] : entity["end"]], entity_group)
path: gradio/components/highlighted_text.py
text: @user1:
This should be 
```suggestion
                        (text[entity["start"] : entity["end"]], entity[entity_group])
```
right?