Spaces:
Build error
Build error
Commit
·
45cd56e
1
Parent(s):
0464579
Update app.py
Browse files
app.py
CHANGED
@@ -35,9 +35,6 @@ def tokenize_and_convert_to_ids(text):
|
|
35 |
|
36 |
def ner_tagging(text_1):
|
37 |
|
38 |
-
with open("vocab.json",'r') as f:
|
39 |
-
vocab = json.load(f)
|
40 |
-
|
41 |
with open('mapping.json','r') as f:
|
42 |
mapping = json.load(f)
|
43 |
|
@@ -45,7 +42,6 @@ def ner_tagging(text_1):
|
|
45 |
custom_objects={'CustomNonPaddingTokenLoss':CustomNonPaddingTokenLoss},
|
46 |
compile=False)
|
47 |
|
48 |
-
lookup_layer = keras.layers.StringLookup(vocabulary=vocab['tokens'])
|
49 |
|
50 |
sample_input = tokenize_and_convert_to_ids(text_1)
|
51 |
sample_input = tf.reshape(sample_input, shape=[1, -1])
|
@@ -57,9 +53,13 @@ def ner_tagging(text_1):
|
|
57 |
return prediction
|
58 |
|
59 |
text_1 = gr.inputs.Textbox(lines=5)
|
60 |
-
|
61 |
ner_tag = gr.outputs.Textbox()
|
62 |
|
|
|
|
|
|
|
|
|
|
|
63 |
iface = gr.Interface(ner_tagging,
|
64 |
inputs=text_1,outputs=ner_tag, examples=[['EU rejects German call to boycott British lamb .'],
|
65 |
["Wednesday's U.S. Open draw ceremony revealed that both title holders should run into their first serious opposition in the third round."]], title="Named Entity Recognition with Transformers",
|
|
|
35 |
|
36 |
def ner_tagging(text_1):
|
37 |
|
|
|
|
|
|
|
38 |
with open('mapping.json','r') as f:
|
39 |
mapping = json.load(f)
|
40 |
|
|
|
42 |
custom_objects={'CustomNonPaddingTokenLoss':CustomNonPaddingTokenLoss},
|
43 |
compile=False)
|
44 |
|
|
|
45 |
|
46 |
sample_input = tokenize_and_convert_to_ids(text_1)
|
47 |
sample_input = tf.reshape(sample_input, shape=[1, -1])
|
|
|
53 |
return prediction
|
54 |
|
55 |
text_1 = gr.inputs.Textbox(lines=5)
|
|
|
56 |
ner_tag = gr.outputs.Textbox()
|
57 |
|
58 |
+
with open("vocab.json",'r') as f:
|
59 |
+
vocab = json.load(f)
|
60 |
+
|
61 |
+
lookup_layer = keras.layers.StringLookup(vocabulary=vocab['tokens'])
|
62 |
+
|
63 |
iface = gr.Interface(ner_tagging,
|
64 |
inputs=text_1,outputs=ner_tag, examples=[['EU rejects German call to boycott British lamb .'],
|
65 |
["Wednesday's U.S. Open draw ceremony revealed that both title holders should run into their first serious opposition in the third round."]], title="Named Entity Recognition with Transformers",
|