Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -280,20 +280,28 @@ if __name__ == "__main__":
|
|
| 280 |
|
| 281 |
st.title("Hugging Face Model Evaluation Demo")
|
| 282 |
|
| 283 |
-
|
| 284 |
-
input_text = st.text_area("Enter model and dataset identifiers", "")
|
| 285 |
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 289 |
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
|
|
|
| 280 |
|
| 281 |
st.title("Hugging Face Model Evaluation Demo")
|
| 282 |
|
| 283 |
+
with st.form("my_form"):
|
|
|
|
| 284 |
|
| 285 |
+
# Create an input text box
|
| 286 |
+
input_text1 = st.text_area("Enter model and dataset identifiers", "")
|
| 287 |
+
input_text2 = st.text_area("Enter model and dataset identifiers", "")
|
| 288 |
+
|
| 289 |
+
# Every form must have a submit button.
|
| 290 |
+
submitted = st.form_submit_button("Submit")
|
| 291 |
+
|
| 292 |
+
if submitted:
|
| 293 |
+
print(input_text1, input_text2)
|
| 294 |
+
# hardcode input data
|
| 295 |
+
model_checkpoint = "sgugger/glue-mrpc"
|
| 296 |
+
dataset_name = "nyu-mll/glue"
|
| 297 |
|
| 298 |
+
metric = load("glue", "mrpc")
|
| 299 |
+
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)
|
| 300 |
+
in_container = False
|
| 301 |
+
model_checkpoint = model_checkpoint
|
| 302 |
+
raw_datasets = load_dataset(dataset_name, "mrpc")
|
| 303 |
+
metric = load("glue", "mrpc")
|
| 304 |
+
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)
|
| 305 |
+
output = compute_model_card_evaluation_results(tokenizer, model_checkpoint, raw_datasets, metric)
|
| 306 |
+
print(json.dumps(output))
|
| 307 |
+
st.text_area(label="Output Data:", value=output, height=350)
|