Update ✨Entity Linking Application✨.py
Browse files- ✨Entity Linking Application✨.py +11 -12
✨Entity Linking Application✨.py
CHANGED
@@ -270,13 +270,12 @@ def main_cli():
|
|
270 |
st.title("✨ Entity Linking Application ✨")
|
271 |
st.caption("This web application is part of my master’s dissertation.")
|
272 |
|
273 |
-
if
|
274 |
-
st.session_state.
|
275 |
-
|
276 |
-
|
277 |
-
st.session_state.button_disabled = False
|
278 |
|
279 |
-
api_token = st.text_input("Enter your API key from [GitHub](https://github.com/marketplace/models/azure-openai/gpt-4o):", "", type="password", disabled=st.session_state.
|
280 |
|
281 |
if api_token:
|
282 |
endpoint = "https://models.inference.ai.azure.com"
|
@@ -289,13 +288,13 @@ def main_cli():
|
|
289 |
else:
|
290 |
st.warning("Please enter an API token to proceed.")
|
291 |
|
292 |
-
input_sentence_user = st.text_input("Enter a sentence:", "", disabled=st.session_state.
|
293 |
-
input_mention_user = st.text_input("Enter a textural reference (mention) that is inside the sentence:", "", disabled=st.session_state.
|
294 |
-
single = st.selectbox("Search each word individually? (Useful for difficult mentions)", ['Yes', 'No'], index=1, disabled=st.session_state.
|
295 |
-
combi = st.selectbox("Make combinations of each word? (Useful for difficult mentions)", ['Yes', 'No'], index=1, disabled=st.session_state.
|
296 |
-
disambi = st.selectbox("Run acronym disambiguation? (Enable it if the mention include an acronym or if it is nested)", ['Yes', 'No'], index=0, disabled=st.session_state.
|
297 |
|
298 |
-
if st.button("Run Entity Linking", key="
|
299 |
if input_sentence_user and input_mention_user:
|
300 |
# check if the mention is in the sentence
|
301 |
if input_mention_user in input_sentence_user:
|
|
|
270 |
st.title("✨ Entity Linking Application ✨")
|
271 |
st.caption("This web application is part of my master’s dissertation.")
|
272 |
|
273 |
+
if 'disabled' in st.session_state and st.session_state.run_button == True:
|
274 |
+
st.session_state.running = True
|
275 |
+
else:
|
276 |
+
st.session_state.running = False
|
|
|
277 |
|
278 |
+
api_token = st.text_input("Enter your API key from [GitHub](https://github.com/marketplace/models/azure-openai/gpt-4o):", "", type="password", disabled=st.session_state.running)
|
279 |
|
280 |
if api_token:
|
281 |
endpoint = "https://models.inference.ai.azure.com"
|
|
|
288 |
else:
|
289 |
st.warning("Please enter an API token to proceed.")
|
290 |
|
291 |
+
input_sentence_user = st.text_input("Enter a sentence:", "", disabled=st.session_state.running)
|
292 |
+
input_mention_user = st.text_input("Enter a textural reference (mention) that is inside the sentence:", "", disabled=st.session_state.running)
|
293 |
+
single = st.selectbox("Search each word individually? (Useful for difficult mentions)", ['Yes', 'No'], index=1, disabled=st.session_state.running)
|
294 |
+
combi = st.selectbox("Make combinations of each word? (Useful for difficult mentions)", ['Yes', 'No'], index=1, disabled=st.session_state.running)
|
295 |
+
disambi = st.selectbox("Run acronym disambiguation? (Enable it if the mention include an acronym or if it is nested)", ['Yes', 'No'], index=0, disabled=st.session_state.running)
|
296 |
|
297 |
+
if st.button("Run Entity Linking", key="disabled", disabled=st.session_state.running):
|
298 |
if input_sentence_user and input_mention_user:
|
299 |
# check if the mention is in the sentence
|
300 |
if input_mention_user in input_sentence_user:
|