Spaces:
Sleeping
Sleeping
added examples to make it easier for users to
Browse files
app.py
CHANGED
@@ -19,14 +19,23 @@ def token_classification(sentence):
|
|
19 |
|
20 |
return formatted_results
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
# Gradio interface
|
23 |
demo = gr.Interface(
|
24 |
fn=token_classification,
|
25 |
-
inputs=gr.Textbox(label="Enter your sentence here", placeholder="
|
26 |
outputs=gr.Textbox(label="Extracted Named Entities", placeholder="The extracted entities will appear here", lines=6),
|
27 |
title="Named Entity Recognition",
|
28 |
description="Extract and classify named entities like people, organizations, and locations from the input text.",
|
29 |
theme="dark-grass", # Optional: Use a clean and minimal theme
|
30 |
allow_flagging="never", # Optional: Disable flagging to reduce distractions
|
|
|
31 |
)
|
32 |
demo.launch()
|
|
|
19 |
|
20 |
return formatted_results
|
21 |
|
22 |
+
examples = [
|
23 |
+
["Elon Musk founded SpaceX in California."],
|
24 |
+
["Cristiano Ronaldo plays for Al Nassr in Saudi Arabia."],
|
25 |
+
["Apple Inc. was founded by Steve Jobs. It is headquartered in Cupertino, California."],
|
26 |
+
["Albert Einstein developed the theory of relativity in Germany."],
|
27 |
+
["Harry Potter studied at Hogwarts in the United Kingdom."]
|
28 |
+
]
|
29 |
+
|
30 |
# Gradio interface
|
31 |
demo = gr.Interface(
|
32 |
fn=token_classification,
|
33 |
+
inputs=gr.Textbox(label="Enter your sentence here", placeholder= "Enter a sentence to extract named entities (e.g., 'Lionel Messi plays for Inter Miami in the United States.')", lines=3)
|
34 |
outputs=gr.Textbox(label="Extracted Named Entities", placeholder="The extracted entities will appear here", lines=6),
|
35 |
title="Named Entity Recognition",
|
36 |
description="Extract and classify named entities like people, organizations, and locations from the input text.",
|
37 |
theme="dark-grass", # Optional: Use a clean and minimal theme
|
38 |
allow_flagging="never", # Optional: Disable flagging to reduce distractions
|
39 |
+
examples=examples, # Optional: Add examples to make it easier for users
|
40 |
)
|
41 |
demo.launch()
|