lewtun HF staff commited on
Commit
0d5e0f7
1 Parent(s): f92be50

Add basic functionality for datasets and models

Browse files
Files changed (2) hide show
  1. app.py +30 -1
  2. requirements.txt +1 -0
app.py CHANGED
@@ -1,3 +1,32 @@
1
  import streamlit as st
 
2
 
3
- st.write("Hello world!")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
+ from huggingface_hub import DatasetFilter, HfApi, ModelFilter
3
 
4
+ api = HfApi()
5
+
6
+
7
+ def get_metadata(dataset_name):
8
+ filt = DatasetFilter(dataset_name=dataset_name)
9
+ data = api.list_datasets(filter=filt, full=True)
10
+ return data[0].cardData["train-eval-index"]
11
+
12
+
13
+ def get_compatible_models(task, dataset_name):
14
+ filt = ModelFilter(task=task, trained_dataset=dataset_name)
15
+ compatible_models = api.list_models(filter=filt)
16
+ return [model.modelId for model in compatible_models]
17
+
18
+
19
+ with st.form(key="form"):
20
+
21
+ dataset_name = st.selectbox("Select a dataset to evaluate on", ["lewtun/autoevaluate_emotion"])
22
+
23
+ metadata = get_metadata(dataset_name)
24
+
25
+ compatible_models = get_compatible_models(metadata[0]["task"], dataset_name.split("/")[-1].split("_")[-1])
26
+
27
+ options = st.multiselect("Select the models you wish to evaluate", compatible_models)
28
+
29
+ submit_button = st.form_submit_button("Make Submission")
30
+
31
+ if submit_button:
32
+ st.success(f"✅ Evaluation was successfully submitted for evaluation with job ID ")
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ huggingface-hub==0.4.0