Spaces:
Runtime error
Runtime error
Update ✨Entity Linking Application✨.py
Browse files
✨Entity Linking Application✨.py
CHANGED
|
@@ -278,9 +278,6 @@ async def main(name):
|
|
| 278 |
# return True
|
| 279 |
|
| 280 |
# return False
|
| 281 |
-
|
| 282 |
-
chrome_driver_path = "chromedriver.exe"
|
| 283 |
-
chrome_path = r'"C:\Program Files\Google\Chrome\Application\chrome.exe"'
|
| 284 |
|
| 285 |
def main_cli():
|
| 286 |
st.title("✨ Entity Linking Application ✨")
|
|
@@ -289,8 +286,8 @@ def main_cli():
|
|
| 289 |
|
| 290 |
input_sentence_user = st.text_input("Enter a sentence:", "")
|
| 291 |
input_mention_user = st.text_input("Enter a textural reference (mention) that is inside the sentence:", "")
|
| 292 |
-
single = st.selectbox("Search each word individually?", ['Yes', 'No'], index=1)
|
| 293 |
-
combi = st.selectbox("Make combinations of each word?", ['Yes', 'No'], index=1)
|
| 294 |
disambi = st.selectbox("Run acronym disambiguation? (Enable it if the mention is nested)", ['Yes', 'No'], index=0)
|
| 295 |
|
| 296 |
|
|
@@ -484,16 +481,17 @@ def main_cli():
|
|
| 484 |
sparql.setQuery(wikidata2dbpedia)
|
| 485 |
sparql.setReturnFormat(JSON)
|
| 486 |
results = sparql.query().convert()
|
|
|
|
| 487 |
for result in results["results"]["bindings"]:
|
| 488 |
dbpedia = result["dbpedia"]["value"]
|
| 489 |
|
|
|
|
| 490 |
st.text(f"The correct entity for '{o}' is:")
|
| 491 |
st.success(f"Wikipedia: {wikipedia}")
|
| 492 |
st.success(f"Wikidata: {k}")
|
| 493 |
st.success(f"DBpedia: {dbpedia}")
|
| 494 |
else:
|
| 495 |
st.warning(f"The entity: {o} is NIL.")
|
| 496 |
-
st.write(f"✅ Applied Candidate Matching module (5/5) [{number}/{len(list_with_full_names)}]")
|
| 497 |
else:
|
| 498 |
st.warning(f"The mention '{input_mention_user}' was NOT found in the sentence.")
|
| 499 |
else:
|
|
@@ -501,7 +499,7 @@ def main_cli():
|
|
| 501 |
end_time = time.time()
|
| 502 |
execution_time = end_time - start_time
|
| 503 |
ETA = time.strftime("%H:%M:%S", time.gmtime(execution_time))
|
| 504 |
-
st.write(f"Execution time: {ETA}")
|
| 505 |
|
| 506 |
# i think this part can be removed now
|
| 507 |
folder_path = "qids_folder"
|
|
|
|
| 278 |
# return True
|
| 279 |
|
| 280 |
# return False
|
|
|
|
|
|
|
|
|
|
| 281 |
|
| 282 |
def main_cli():
|
| 283 |
st.title("✨ Entity Linking Application ✨")
|
|
|
|
| 286 |
|
| 287 |
input_sentence_user = st.text_input("Enter a sentence:", "")
|
| 288 |
input_mention_user = st.text_input("Enter a textural reference (mention) that is inside the sentence:", "")
|
| 289 |
+
single = st.selectbox("Search each word individually? (Useful for difficult mentions)", ['Yes', 'No'], index=1)
|
| 290 |
+
combi = st.selectbox("Make combinations of each word? (Useful for difficult mentions)", ['Yes', 'No'], index=1)
|
| 291 |
disambi = st.selectbox("Run acronym disambiguation? (Enable it if the mention is nested)", ['Yes', 'No'], index=0)
|
| 292 |
|
| 293 |
|
|
|
|
| 481 |
sparql.setQuery(wikidata2dbpedia)
|
| 482 |
sparql.setReturnFormat(JSON)
|
| 483 |
results = sparql.query().convert()
|
| 484 |
+
|
| 485 |
for result in results["results"]["bindings"]:
|
| 486 |
dbpedia = result["dbpedia"]["value"]
|
| 487 |
|
| 488 |
+
st.write(f"✅ Applied Candidate Matching module (5/5) [{number}/{len(list_with_full_names)}]")
|
| 489 |
st.text(f"The correct entity for '{o}' is:")
|
| 490 |
st.success(f"Wikipedia: {wikipedia}")
|
| 491 |
st.success(f"Wikidata: {k}")
|
| 492 |
st.success(f"DBpedia: {dbpedia}")
|
| 493 |
else:
|
| 494 |
st.warning(f"The entity: {o} is NIL.")
|
|
|
|
| 495 |
else:
|
| 496 |
st.warning(f"The mention '{input_mention_user}' was NOT found in the sentence.")
|
| 497 |
else:
|
|
|
|
| 499 |
end_time = time.time()
|
| 500 |
execution_time = end_time - start_time
|
| 501 |
ETA = time.strftime("%H:%M:%S", time.gmtime(execution_time))
|
| 502 |
+
st.write(f"⌛ Execution time: {ETA}")
|
| 503 |
|
| 504 |
# i think this part can be removed now
|
| 505 |
folder_path = "qids_folder"
|