Shaffique Aljoofri
commited on
Commit
·
e033fcf
1
Parent(s):
9b46b44
Update app.py
Browse files
app.py
CHANGED
|
@@ -20,22 +20,22 @@ def get_completion(inputs, parameters = None):
|
|
| 20 |
|
| 21 |
response = requests.post(hf_api_url, headers = headers, data = json.dumps(payload))
|
| 22 |
|
| 23 |
-
return
|
| 24 |
|
| 25 |
### Gradio App
|
| 26 |
import gradio as gr
|
| 27 |
|
| 28 |
def ner(text):
|
| 29 |
output = get_completion(text)
|
| 30 |
-
return {"text": text, "entities": output}
|
| 31 |
|
| 32 |
examples = [
|
| 33 |
-
"Does Chicago have any stores and does Joe live here?"
|
| 34 |
]
|
| 35 |
|
| 36 |
-
demo = gr.Interface(
|
| 37 |
-
|
| 38 |
-
|
| 39 |
examples = examples)
|
| 40 |
|
| 41 |
demo.launch()
|
|
|
|
| 20 |
|
| 21 |
response = requests.post(hf_api_url, headers = headers, data = json.dumps(payload))
|
| 22 |
|
| 23 |
+
return response.json()
|
| 24 |
|
| 25 |
### Gradio App
|
| 26 |
import gradio as gr
|
| 27 |
|
| 28 |
def ner(text):
|
| 29 |
output = get_completion(text)
|
| 30 |
+
return {"text" : text, "entities" : output}
|
| 31 |
|
| 32 |
examples = [
|
| 33 |
+
"Does Chicago have any stores and does Joe live here?"
|
| 34 |
]
|
| 35 |
|
| 36 |
+
demo = gr.Interface(ner,
|
| 37 |
+
gr.Textbox(placeholder="Enter sentence here..."),
|
| 38 |
+
gr.HighlightedText(),
|
| 39 |
examples = examples)
|
| 40 |
|
| 41 |
demo.launch()
|