Updates demo installation
Browse files
app.py
CHANGED
@@ -1,17 +1,16 @@
|
|
1 |
import subprocess
|
2 |
|
3 |
-
|
4 |
-
subprocess.run(["pip", "install", "
|
5 |
-
|
6 |
-
|
7 |
-
subprocess.run(["pip", "install", "numpy==1.26.4"])
|
8 |
-
|
9 |
-
subprocess.run(["python", "-m", "spacy", "download", "en_core_web_sm"])
|
10 |
-
subprocess.run(["python", "-m", "spacy", "download", "en_core_web_md"])
|
11 |
-
subprocess.run(["python", "-m", "spacy", "download", "en_core_web_lg"])
|
12 |
|
|
|
13 |
|
|
|
|
|
14 |
|
|
|
15 |
|
16 |
from typing import Dict, Union
|
17 |
import gradio as gr
|
@@ -39,7 +38,7 @@ examples = [
|
|
39 |
|
40 |
|
41 |
# Load the relation extraction model
|
42 |
-
rel_model = GLiREL.from_pretrained("jackboyla/
|
43 |
|
44 |
# Function to perform Named Entity Recognition
|
45 |
def perform_ner(text, model_name):
|
@@ -92,7 +91,7 @@ with gr.Blocks() as demo:
|
|
92 |
gr.Markdown("GitHub: https://github.com/jackboyla/GLiREL")
|
93 |
|
94 |
text_input = gr.Textbox(label="Input Text", value="Jack lives in London but he was born in Mongolia.")
|
95 |
-
model_name_input = gr.Dropdown(choices=["
|
96 |
labels_input = gr.Textbox(label="Relation Labels (comma-separated)", value="country of origin, licensed to broadcast to, father, followed by, characters")
|
97 |
|
98 |
ner_output = gr.HighlightedText(label="NER")
|
|
|
1 |
import subprocess
|
2 |
|
3 |
+
# install required packages
|
4 |
+
subprocess.run(["pip", "install", "-U", "gradio"])
|
5 |
+
|
6 |
+
repo_url = "https://github.com/jackboyla/GLiREL"
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
+
subprocess.run(["git", "clone", repo_url])
|
9 |
|
10 |
+
subprocess.run(["pip", "install", "./GLiREL"])
|
11 |
+
subprocess.run(["pip", "install", "-r", "./GLiREL/requirements.txt"])
|
12 |
|
13 |
+
subprocess.run(["python", "-m", "spacy", "download", "en_core_web_lg"])
|
14 |
|
15 |
from typing import Dict, Union
|
16 |
import gradio as gr
|
|
|
38 |
|
39 |
|
40 |
# Load the relation extraction model
|
41 |
+
rel_model = GLiREL.from_pretrained("jackboyla/glirel-large-v0")
|
42 |
|
43 |
# Function to perform Named Entity Recognition
|
44 |
def perform_ner(text, model_name):
|
|
|
91 |
gr.Markdown("GitHub: https://github.com/jackboyla/GLiREL")
|
92 |
|
93 |
text_input = gr.Textbox(label="Input Text", value="Jack lives in London but he was born in Mongolia.")
|
94 |
+
model_name_input = gr.Dropdown(choices=["en_core_web_lg"], label="NER Model", value="en_core_web_lg")
|
95 |
labels_input = gr.Textbox(label="Relation Labels (comma-separated)", value="country of origin, licensed to broadcast to, father, followed by, characters")
|
96 |
|
97 |
ner_output = gr.HighlightedText(label="NER")
|