Spaces:
Runtime error
Runtime error
Commit ·
c95b0d0
1
Parent(s): 7adb320
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,7 +8,7 @@ import torch
|
|
| 8 |
from transformers import RobertaForSequenceClassification, RobertaTokenizerFast
|
| 9 |
|
| 10 |
|
| 11 |
-
|
| 12 |
LOCAL_CHECKPOINT = "models/best"
|
| 13 |
LABELS = ["claim", "counter_claim", "premise", "unknown"]
|
| 14 |
LABEL_DISPLAY = {
|
|
@@ -153,15 +153,17 @@ st.title("Argument Role Classifier")
|
|
| 153 |
|
| 154 |
with st.sidebar:
|
| 155 |
st.header("Model")
|
|
|
|
| 156 |
model_location = st.radio(
|
| 157 |
"Checkpoint source",
|
| 158 |
-
|
| 159 |
index=0,
|
| 160 |
)
|
| 161 |
checkpoint = (
|
| 162 |
-
|
| 163 |
)
|
| 164 |
-
|
|
|
|
| 165 |
|
| 166 |
render_label_reference()
|
| 167 |
|
|
|
|
| 8 |
from transformers import RobertaForSequenceClassification, RobertaTokenizerFast
|
| 9 |
|
| 10 |
|
| 11 |
+
REMOTE_CHECKPOINT = "Pengchong1113/argument-role-classifier"
|
| 12 |
LOCAL_CHECKPOINT = "models/best"
|
| 13 |
LABELS = ["claim", "counter_claim", "premise", "unknown"]
|
| 14 |
LABEL_DISPLAY = {
|
|
|
|
| 153 |
|
| 154 |
with st.sidebar:
|
| 155 |
st.header("Model")
|
| 156 |
+
checkpoint_options = ["Remote", "Local"] if REMOTE_CHECKPOINT else ["Local"]
|
| 157 |
model_location = st.radio(
|
| 158 |
"Checkpoint source",
|
| 159 |
+
checkpoint_options,
|
| 160 |
index=0,
|
| 161 |
)
|
| 162 |
checkpoint = (
|
| 163 |
+
REMOTE_CHECKPOINT if model_location == "Remote" else LOCAL_CHECKPOINT
|
| 164 |
)
|
| 165 |
+
if model_location == "Local" and not Path(LOCAL_CHECKPOINT).exists():
|
| 166 |
+
st.info("Place local model files under models/best, or switch to Remote.")
|
| 167 |
|
| 168 |
render_label_reference()
|
| 169 |
|