Spaces:
Runtime error
Runtime error
Ezi Ozoani
commited on
Commit
β’
25cf4f2
1
Parent(s):
a734906
cleaning
Browse files- 1_π_form.py +3 -16
- __pycache__/middleMan.cpython-39.pyc +0 -0
- language_model_template1.md +1 -1
- middleMan.py +1 -56
- pages/10_ π_Technical Specifications.py +1 -1
- pages/11_ π¬_Model_Card_Contact.py +1 -1
- pages/12_π©βπ»_How_To_Get_Started.py +1 -1
- pages/13_π_Model_Card_Authors.py +1 -2
- pages/14_π_Glossary.py +0 -2
- pages/15_More_Information.py +0 -2
- pages/2_π_Model_Details.py +1 -1
- pages/3_ π_Uses.py +0 -4
- pages/4_β οΈ_Limits_and_Risks.py +1 -1
- pages/5_ποΈββοΈ_Model_training.py +0 -3
- pages/7_π_Model_Examination.py +1 -1
- pages/8_π_Environmental_Impact.py +1 -1
- pages/9_π_Citation.py +1 -1
- test_markdown_out.py +1 -1
1_π_form.py
CHANGED
@@ -10,7 +10,6 @@ import pandas as pd
|
|
10 |
from huggingface_hub import create_repo
|
11 |
import os
|
12 |
from middleMan import parse_into_jinja_markdown as pj
|
13 |
-
#from pages import 1_π_CardProgress
|
14 |
|
15 |
@st.cache
|
16 |
def get_cached_data():
|
@@ -30,6 +29,7 @@ def get_cached_data():
|
|
30 |
tasks = [x['id'] for x in tags_data['pipeline_tag']]
|
31 |
return languages_map, license_map, available_metrics, libraries, tasks
|
32 |
|
|
|
33 |
def card_upload(card_info,repo_id,token):
|
34 |
#commit_message=None,
|
35 |
repo_type = "space"
|
@@ -111,10 +111,7 @@ def main():
|
|
111 |
"the_authors":"",
|
112 |
"Model_details_text": "",
|
113 |
"Model_developers": "",
|
114 |
-
|
115 |
-
"Machine_Learning_Type":[],
|
116 |
-
"Modality":[],
|
117 |
-
"Supervision_learning_method":[],
|
118 |
|
119 |
"Model_how_to": "",
|
120 |
|
@@ -147,7 +144,6 @@ def main():
|
|
147 |
"Model_cite": "",
|
148 |
"paper_url": "",
|
149 |
"github_url": "",
|
150 |
-
"blog_url":"",
|
151 |
"bibtex_citation": "",
|
152 |
"APA_citation":"",
|
153 |
|
@@ -167,11 +163,6 @@ def main():
|
|
167 |
"researcher_view":bool,
|
168 |
"beginner_technical_view":bool,
|
169 |
"markdown_state":"",
|
170 |
-
|
171 |
-
"testing_Factor": "",
|
172 |
-
"testing_Metrics":"",
|
173 |
-
"model_results":""
|
174 |
-
|
175 |
})
|
176 |
## getting cache for each warnings
|
177 |
languages_map, license_map, available_metrics, libraries, tasks = get_cached_data()
|
@@ -181,8 +172,6 @@ def main():
|
|
181 |
|
182 |
warning_placeholder = st.empty()
|
183 |
|
184 |
-
Supervision_learning_method_list = ["Unsupervised","Semi-supervised","Self-supervised","Supervised"]
|
185 |
-
|
186 |
st.text_input("Model Name", key=persist("model_name"))
|
187 |
st.text_area("Model Description", help="The model description provides basic details about the model. This includes the architecture, version, if it was introduced in a paper, if an original implementation is available, the author, and general information about the model. Any copyright should be attributed here. General information about training procedures, parameters, and important disclaimers can also be mentioned in this section.", key=persist('model_description'))
|
188 |
st.multiselect("Language(s)", list(languages_map), format_func=lambda x: languages_map[x], help="The language(s) associated with this model. If this is not a text-based model, you should specify whatever lanuage is used in the dataset. For instance, if the dataset's labels are in english, you should select English here.", key=persist("languages"))
|
@@ -195,10 +184,8 @@ def main():
|
|
195 |
st.text_input("Author(s) (comma separated)", help="The authors who developed this model. If you trained this model, the author is you.", key=persist("the_authors"))
|
196 |
st.text_input("Related Research Paper", help="Research paper related to this model.", key=persist("paper_url"))
|
197 |
st.text_input("Related GitHub Repository", help="Link to a GitHub repository used in the development of this model", key=persist("github_url"))
|
198 |
-
st.text_input("Related Blog Post", help="Link to a blog post related to this model.", key=persist("blog_url"))
|
199 |
st.text_area("Bibtex Citation", help="Bibtex citations for related work", key=persist("bibtex_citations"))
|
200 |
st.text_input("Carbon Emitted:", help="You can estimate carbon emissions using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700)", key=persist("Model_c02_emitted"))
|
201 |
-
|
202 |
# warnings setting
|
203 |
languages=st.session_state.languages or None
|
204 |
license=st.session_state.license or None
|
@@ -290,4 +277,4 @@ def main():
|
|
290 |
|
291 |
if __name__ == '__main__':
|
292 |
load_widget_state()
|
293 |
-
main()
|
|
|
10 |
from huggingface_hub import create_repo
|
11 |
import os
|
12 |
from middleMan import parse_into_jinja_markdown as pj
|
|
|
13 |
|
14 |
@st.cache
|
15 |
def get_cached_data():
|
|
|
29 |
tasks = [x['id'] for x in tags_data['pipeline_tag']]
|
30 |
return languages_map, license_map, available_metrics, libraries, tasks
|
31 |
|
32 |
+
|
33 |
def card_upload(card_info,repo_id,token):
|
34 |
#commit_message=None,
|
35 |
repo_type = "space"
|
|
|
111 |
"the_authors":"",
|
112 |
"Model_details_text": "",
|
113 |
"Model_developers": "",
|
114 |
+
"blog_url":"",
|
|
|
|
|
|
|
115 |
|
116 |
"Model_how_to": "",
|
117 |
|
|
|
144 |
"Model_cite": "",
|
145 |
"paper_url": "",
|
146 |
"github_url": "",
|
|
|
147 |
"bibtex_citation": "",
|
148 |
"APA_citation":"",
|
149 |
|
|
|
163 |
"researcher_view":bool,
|
164 |
"beginner_technical_view":bool,
|
165 |
"markdown_state":"",
|
|
|
|
|
|
|
|
|
|
|
166 |
})
|
167 |
## getting cache for each warnings
|
168 |
languages_map, license_map, available_metrics, libraries, tasks = get_cached_data()
|
|
|
172 |
|
173 |
warning_placeholder = st.empty()
|
174 |
|
|
|
|
|
175 |
st.text_input("Model Name", key=persist("model_name"))
|
176 |
st.text_area("Model Description", help="The model description provides basic details about the model. This includes the architecture, version, if it was introduced in a paper, if an original implementation is available, the author, and general information about the model. Any copyright should be attributed here. General information about training procedures, parameters, and important disclaimers can also be mentioned in this section.", key=persist('model_description'))
|
177 |
st.multiselect("Language(s)", list(languages_map), format_func=lambda x: languages_map[x], help="The language(s) associated with this model. If this is not a text-based model, you should specify whatever lanuage is used in the dataset. For instance, if the dataset's labels are in english, you should select English here.", key=persist("languages"))
|
|
|
184 |
st.text_input("Author(s) (comma separated)", help="The authors who developed this model. If you trained this model, the author is you.", key=persist("the_authors"))
|
185 |
st.text_input("Related Research Paper", help="Research paper related to this model.", key=persist("paper_url"))
|
186 |
st.text_input("Related GitHub Repository", help="Link to a GitHub repository used in the development of this model", key=persist("github_url"))
|
|
|
187 |
st.text_area("Bibtex Citation", help="Bibtex citations for related work", key=persist("bibtex_citations"))
|
188 |
st.text_input("Carbon Emitted:", help="You can estimate carbon emissions using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700)", key=persist("Model_c02_emitted"))
|
|
|
189 |
# warnings setting
|
190 |
languages=st.session_state.languages or None
|
191 |
license=st.session_state.license or None
|
|
|
277 |
|
278 |
if __name__ == '__main__':
|
279 |
load_widget_state()
|
280 |
+
main()
|
__pycache__/middleMan.cpython-39.pyc
CHANGED
Binary files a/__pycache__/middleMan.cpython-39.pyc and b/__pycache__/middleMan.cpython-39.pyc differ
|
|
language_model_template1.md
CHANGED
@@ -134,7 +134,7 @@
|
|
134 |
- **Shared by [Optional]:** {{ shared_by | join(', ') | default("More information needed", true)}}
|
135 |
- **Model type:** {{ model_type | default("Language model", true)}}
|
136 |
- **Language(s) (NLP):** {{ language | join(', ') | default("More information needed", true)}}
|
137 |
-
- **License:** {{
|
138 |
- **Related Models:** {{ related_models | join(', ') | default("More information needed", true)}}
|
139 |
- **Parent Model:** {{ parent_model | default("More information needed", true)}}
|
140 |
- **Resources for more information:** {{ more_resources | default("More information needed", true)}}
|
|
|
134 |
- **Shared by [Optional]:** {{ shared_by | join(', ') | default("More information needed", true)}}
|
135 |
- **Model type:** {{ model_type | default("Language model", true)}}
|
136 |
- **Language(s) (NLP):** {{ language | join(', ') | default("More information needed", true)}}
|
137 |
+
- **License:** {{ model_license | default("More information needed", true)}}
|
138 |
- **Related Models:** {{ related_models | join(', ') | default("More information needed", true)}}
|
139 |
- **Parent Model:** {{ parent_model | default("More information needed", true)}}
|
140 |
- **Resources for more information:** {{ more_resources | default("More information needed", true)}}
|
middleMan.py
CHANGED
@@ -25,7 +25,7 @@ def parse_into_jinja_markdown():
|
|
25 |
# citation on form: check box for bibtex or apa: then parse
|
26 |
return (temp.render(model_id = st.session_state["model_name"],
|
27 |
language = st.session_state["languages"],
|
28 |
-
the_model_description = st.session_state["model_description"],developers=st.session_state["Model_developers"],shared_by = st.session_state["shared_by"],
|
29 |
direct_use = st.session_state["Direct_Use"], downstream_use = st.session_state["Downstream_Use"],out_of_scope_use = st.session_state["Out-of-Scope_Use"],
|
30 |
bias_risks_limitations = st.session_state["Model_Limits_n_Risks"], bias_recommendations = st.session_state['Recommendations'],
|
31 |
model_examination = st.session_state['Model_examin'],
|
@@ -58,61 +58,6 @@ def parse_into_jinja_markdown():
|
|
58 |
################################################################
|
59 |
################################################################
|
60 |
|
61 |
-
def get_card():
|
62 |
-
languages=st.session_state.languages or None
|
63 |
-
license=st.session_state.license or None
|
64 |
-
library_name = st.session_state.library_name or None
|
65 |
-
tags= [x.strip() for x in st.session_state.tags.split(',') if x.strip()]
|
66 |
-
tags.append("autogenerated-modelcard")
|
67 |
-
datasets= [x.strip() for x in st.session_state.datasets.split(',') if x.strip()] or None
|
68 |
-
metrics=st.session_state.metrics or None
|
69 |
-
model_name = st.session_state.model_name or None
|
70 |
-
model_description = st.session_state.model_description or None
|
71 |
-
authors = st.session_state.Model_card_authors or None
|
72 |
-
paper_url = st.session_state.paper_url or None
|
73 |
-
github_url = st.session_state.github_url or None
|
74 |
-
bibtex_citations = st.session_state.bibtex_citations or None
|
75 |
-
emissions = float(st.session_state.Model_c02_emitted) if is_float(st.session_state.Model_c02_emitted) else None # BUG
|
76 |
-
|
77 |
-
# Handle any warnings...
|
78 |
-
do_warn = False
|
79 |
-
warning_msg = "Warning: The following fields are required but have not been filled in: "
|
80 |
-
if not languages:
|
81 |
-
warning_msg += "\n- Languages"
|
82 |
-
do_warn = True
|
83 |
-
if not license:
|
84 |
-
warning_msg += "\n- License"
|
85 |
-
do_warn = True
|
86 |
-
if do_warn:
|
87 |
-
st.error(warning_msg)
|
88 |
-
st.stop()
|
89 |
-
|
90 |
-
# Generate and display card
|
91 |
-
card_data = CardData(
|
92 |
-
language=languages,
|
93 |
-
license=license,
|
94 |
-
library_name=library_name,
|
95 |
-
tags=tags,
|
96 |
-
datasets=datasets,
|
97 |
-
metrics=metrics,
|
98 |
-
)
|
99 |
-
if emissions:
|
100 |
-
card_data.co2_eq_emissions = {'emissions': emissions}
|
101 |
-
|
102 |
-
card = ModelCard.from_template(
|
103 |
-
card_data,
|
104 |
-
template_path='template.md',
|
105 |
-
model_id=model_name,
|
106 |
-
# Template kwargs:
|
107 |
-
model_description=model_description,
|
108 |
-
license=license,
|
109 |
-
authors=authors,
|
110 |
-
paper_url=paper_url,
|
111 |
-
github_url=github_url,
|
112 |
-
bibtex_citations=bibtex_citations,
|
113 |
-
emissions=emissions
|
114 |
-
)
|
115 |
-
return card
|
116 |
|
117 |
|
118 |
def apply_view(page_state, not_code_pull,text_passed):
|
|
|
25 |
# citation on form: check box for bibtex or apa: then parse
|
26 |
return (temp.render(model_id = st.session_state["model_name"],
|
27 |
language = st.session_state["languages"],
|
28 |
+
the_model_description = st.session_state["model_description"],developers=st.session_state["Model_developers"],shared_by = st.session_state["shared_by"],model_license = st.session_state['license'],
|
29 |
direct_use = st.session_state["Direct_Use"], downstream_use = st.session_state["Downstream_Use"],out_of_scope_use = st.session_state["Out-of-Scope_Use"],
|
30 |
bias_risks_limitations = st.session_state["Model_Limits_n_Risks"], bias_recommendations = st.session_state['Recommendations'],
|
31 |
model_examination = st.session_state['Model_examin'],
|
|
|
58 |
################################################################
|
59 |
################################################################
|
60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
|
62 |
|
63 |
def apply_view(page_state, not_code_pull,text_passed):
|
pages/10_ π_Technical Specifications.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import streamlit as st
|
2 |
from persist import persist, load_widget_state
|
3 |
-
|
4 |
#from specific_extraction import extract_it
|
5 |
|
6 |
|
|
|
1 |
import streamlit as st
|
2 |
from persist import persist, load_widget_state
|
3 |
+
|
4 |
#from specific_extraction import extract_it
|
5 |
|
6 |
|
pages/11_ π¬_Model_Card_Contact.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import streamlit as st
|
2 |
from persist import persist, load_widget_state
|
3 |
-
|
4 |
#from specific_extraction import extract_it
|
5 |
|
6 |
|
|
|
1 |
import streamlit as st
|
2 |
from persist import persist, load_widget_state
|
3 |
+
|
4 |
#from specific_extraction import extract_it
|
5 |
|
6 |
|
pages/12_π©βπ»_How_To_Get_Started.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import streamlit as st
|
2 |
from persist import persist, load_widget_state
|
3 |
-
|
4 |
from extract_code import read_file
|
5 |
|
6 |
|
|
|
1 |
import streamlit as st
|
2 |
from persist import persist, load_widget_state
|
3 |
+
|
4 |
from extract_code import read_file
|
5 |
|
6 |
|
pages/13_π_Model_Card_Authors.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
import streamlit as st
|
2 |
from persist import persist, load_widget_state
|
3 |
-
|
4 |
-
#from specific_extraction import extract_it
|
5 |
|
6 |
|
7 |
global variable_output
|
|
|
1 |
import streamlit as st
|
2 |
from persist import persist, load_widget_state
|
3 |
+
|
|
|
4 |
|
5 |
|
6 |
global variable_output
|
pages/14_π_Glossary.py
CHANGED
@@ -1,7 +1,5 @@
|
|
1 |
import streamlit as st
|
2 |
from persist import persist, load_widget_state
|
3 |
-
from middleMan import get_card,writingPrompt,apply_view
|
4 |
-
#from specific_extraction import extract_it
|
5 |
|
6 |
|
7 |
global variable_output
|
|
|
1 |
import streamlit as st
|
2 |
from persist import persist, load_widget_state
|
|
|
|
|
3 |
|
4 |
|
5 |
global variable_output
|
pages/15_More_Information.py
CHANGED
@@ -1,7 +1,5 @@
|
|
1 |
import streamlit as st
|
2 |
from persist import persist, load_widget_state
|
3 |
-
from middleMan import get_card,writingPrompt,apply_view
|
4 |
-
#from specific_extraction import extract_it
|
5 |
|
6 |
|
7 |
global variable_output
|
|
|
1 |
import streamlit as st
|
2 |
from persist import persist, load_widget_state
|
|
|
|
|
3 |
|
4 |
|
5 |
global variable_output
|
pages/2_π_Model_Details.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import streamlit as st
|
2 |
from persist import persist, load_widget_state
|
3 |
-
from middleMan import get_card,writingPrompt,apply_view
|
4 |
import pandas as pd
|
5 |
import requests
|
6 |
|
|
|
1 |
import streamlit as st
|
2 |
from persist import persist, load_widget_state
|
3 |
+
#from middleMan import get_card,writingPrompt,apply_view
|
4 |
import pandas as pd
|
5 |
import requests
|
6 |
|
pages/3_ π_Uses.py
CHANGED
@@ -1,7 +1,5 @@
|
|
1 |
import streamlit as st
|
2 |
from persist import persist, load_widget_state
|
3 |
-
from middleMan import get_card,writingPrompt,apply_view
|
4 |
-
|
5 |
|
6 |
global variable_output
|
7 |
|
@@ -10,8 +8,6 @@ def main():
|
|
10 |
cs_body()
|
11 |
|
12 |
def cs_body():
|
13 |
-
# Model Cards
|
14 |
-
card = get_card()
|
15 |
|
16 |
st.markdown('# Uses')
|
17 |
st.text_area("Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model",help="Model uses large work")
|
|
|
1 |
import streamlit as st
|
2 |
from persist import persist, load_widget_state
|
|
|
|
|
3 |
|
4 |
global variable_output
|
5 |
|
|
|
8 |
cs_body()
|
9 |
|
10 |
def cs_body():
|
|
|
|
|
11 |
|
12 |
st.markdown('# Uses')
|
13 |
st.text_area("Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model",help="Model uses large work")
|
pages/4_β οΈ_Limits_and_Risks.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import streamlit as st
|
2 |
from persist import persist, load_widget_state
|
3 |
-
|
4 |
|
5 |
|
6 |
global variable_output
|
|
|
1 |
import streamlit as st
|
2 |
from persist import persist, load_widget_state
|
3 |
+
|
4 |
|
5 |
|
6 |
global variable_output
|
pages/5_ποΈββοΈ_Model_training.py
CHANGED
@@ -1,8 +1,5 @@
|
|
1 |
import streamlit as st
|
2 |
from persist import persist, load_widget_state
|
3 |
-
from pathlib import Path
|
4 |
-
|
5 |
-
from middleMan import apply_view,writingPrompt
|
6 |
|
7 |
global variable_output
|
8 |
|
|
|
1 |
import streamlit as st
|
2 |
from persist import persist, load_widget_state
|
|
|
|
|
|
|
3 |
|
4 |
global variable_output
|
5 |
|
pages/7_π_Model_Examination.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import streamlit as st
|
2 |
from persist import persist, load_widget_state
|
3 |
-
|
4 |
#from specific_extraction import extract_it
|
5 |
|
6 |
|
|
|
1 |
import streamlit as st
|
2 |
from persist import persist, load_widget_state
|
3 |
+
|
4 |
#from specific_extraction import extract_it
|
5 |
|
6 |
|
pages/8_π_Environmental_Impact.py
CHANGED
@@ -2,7 +2,7 @@ import streamlit as st
|
|
2 |
from persist import persist, load_widget_state
|
3 |
from pathlib import Path
|
4 |
|
5 |
-
|
6 |
|
7 |
global variable_output
|
8 |
|
|
|
2 |
from persist import persist, load_widget_state
|
3 |
from pathlib import Path
|
4 |
|
5 |
+
|
6 |
|
7 |
global variable_output
|
8 |
|
pages/9_π_Citation.py
CHANGED
@@ -2,7 +2,7 @@ import streamlit as st
|
|
2 |
from persist import persist, load_widget_state
|
3 |
from pathlib import Path
|
4 |
|
5 |
-
|
6 |
|
7 |
global variable_output
|
8 |
|
|
|
2 |
from persist import persist, load_widget_state
|
3 |
from pathlib import Path
|
4 |
|
5 |
+
|
6 |
|
7 |
global variable_output
|
8 |
|
test_markdown_out.py
CHANGED
@@ -7,7 +7,7 @@ def parse_into_jinja_markdown():
|
|
7 |
temp = env.get_template(st.session_state.markdown_upload)
|
8 |
|
9 |
return (temp.render(model_id = st.session_state["model_name"],
|
10 |
-
the_model_description = st.session_state["model_description"],developers=st.session_state["Model_developers"],shared_by = st.session_state["shared_by"],
|
11 |
direct_use = st.session_state["Direct_Use"], downstream_use = st.session_state["Downstream_Use"],out_of_scope_use = st.session_state["Out-of-Scope_Use"],
|
12 |
bias_risks_limitations = st.session_state["Model_Limits_n_Risks"], bias_recommendations = st.session_state['Recommendations'],
|
13 |
model_examination = st.session_state['Model_examin'],
|
|
|
7 |
temp = env.get_template(st.session_state.markdown_upload)
|
8 |
|
9 |
return (temp.render(model_id = st.session_state["model_name"],
|
10 |
+
the_model_description = st.session_state["model_description"],developers=st.session_state["Model_developers"],shared_by = st.session_state["shared_by"],model_license = st.session_state['license'],
|
11 |
direct_use = st.session_state["Direct_Use"], downstream_use = st.session_state["Downstream_Use"],out_of_scope_use = st.session_state["Out-of-Scope_Use"],
|
12 |
bias_risks_limitations = st.session_state["Model_Limits_n_Risks"], bias_recommendations = st.session_state['Recommendations'],
|
13 |
model_examination = st.session_state['Model_examin'],
|