Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,14 +9,18 @@ st.sidebar.image("logo-wordlift.png")
|
|
| 9 |
model_options = {"aida_model", "wikipedia_model_with_numbers"}
|
| 10 |
selected_model_name = st.sidebar.selectbox("Select the Model", list(model_options))
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
@st.cache_resource # ๐ Add the caching decorator
|
| 13 |
-
def load_model(model_name):
|
| 14 |
# Load the pretrained model
|
| 15 |
-
refined_model = Refined.from_pretrained(model_name=model_name, entity_set=
|
| 16 |
return refined_model
|
| 17 |
|
| 18 |
# Use the cached model
|
| 19 |
-
refined_model = load_model(selected_model_name)
|
| 20 |
|
| 21 |
# Helper functions
|
| 22 |
def get_wikidata_id(entity_string):
|
|
|
|
| 9 |
model_options = {"aida_model", "wikipedia_model_with_numbers"}
|
| 10 |
selected_model_name = st.sidebar.selectbox("Select the Model", list(model_options))
|
| 11 |
|
| 12 |
+
# Select entity_set
|
| 13 |
+
entity_set_options = {"wikidata", "wikipedia"}
|
| 14 |
+
selected_entity_set = st.sidebar.selectbox("Select the Entity Set", list(entity_set_options))
|
| 15 |
+
|
| 16 |
@st.cache_resource # ๐ Add the caching decorator
|
| 17 |
+
def load_model(model_name, entity_set):
|
| 18 |
# Load the pretrained model
|
| 19 |
+
refined_model = Refined.from_pretrained(model_name=model_name, entity_set=entity_set)
|
| 20 |
return refined_model
|
| 21 |
|
| 22 |
# Use the cached model
|
| 23 |
+
refined_model = load_model(selected_model_name, selected_entity_set)
|
| 24 |
|
| 25 |
# Helper functions
|
| 26 |
def get_wikidata_id(entity_string):
|