Spaces:
Sleeping
Sleeping
upload to repo fixed
Browse files- 1_📝_form.py +8 -8
- current_card.md +3 -1
1_📝_form.py
CHANGED
@@ -77,9 +77,9 @@ def get_cached_data():
|
|
77 |
|
78 |
def card_upload(card_info,repo_id,token):
|
79 |
#commit_message=None,
|
80 |
-
repo_type = "
|
81 |
commit_description=None,
|
82 |
-
revision=None
|
83 |
create_pr=None
|
84 |
with tempfile.TemporaryDirectory() as tmpdir:
|
85 |
tmp_path = Path(tmpdir) / "README.md"
|
@@ -91,7 +91,7 @@ def card_upload(card_info,repo_id,token):
|
|
91 |
token=token,
|
92 |
repo_type=repo_type,
|
93 |
# identical_ok=True,
|
94 |
-
revision=revision
|
95 |
)
|
96 |
return url
|
97 |
|
@@ -299,11 +299,11 @@ def main_page():
|
|
299 |
|
300 |
st.session_state.markdown_upload = name_of_uploaded_file ## uploaded model card
|
301 |
|
302 |
-
elif st.session_state.task =='fill-mask' or 'translation' or 'token-classification' or ' sentence-similarity' or 'summarization' or 'question-answering' or 'text2text-generation' or 'text-classification' or 'text-generation' or 'conversational':
|
303 |
-
|
304 |
-
|
305 |
|
306 |
-
|
307 |
|
308 |
st.session_state.markdown_upload = "current_card.md" ## default non language model template
|
309 |
print("st.session_state.markdown_upload",st.session_state.markdown_upload)
|
@@ -322,7 +322,7 @@ def main_page():
|
|
322 |
|
323 |
if submit:
|
324 |
if len(repo_id.split('/')) == 2:
|
325 |
-
repo_url =
|
326 |
print("repo_url",repo_url)
|
327 |
card_info = pj()
|
328 |
print(card_info)
|
|
|
77 |
|
78 |
def card_upload(card_info,repo_id,token):
|
79 |
#commit_message=None,
|
80 |
+
repo_type = "model"
|
81 |
commit_description=None,
|
82 |
+
revision=None
|
83 |
create_pr=None
|
84 |
with tempfile.TemporaryDirectory() as tmpdir:
|
85 |
tmp_path = Path(tmpdir) / "README.md"
|
|
|
91 |
token=token,
|
92 |
repo_type=repo_type,
|
93 |
# identical_ok=True,
|
94 |
+
revision=revision
|
95 |
)
|
96 |
return url
|
97 |
|
|
|
299 |
|
300 |
st.session_state.markdown_upload = name_of_uploaded_file ## uploaded model card
|
301 |
|
302 |
+
# elif st.session_state.task =='fill-mask' or 'translation' or 'token-classification' or ' sentence-similarity' or 'summarization' or 'question-answering' or 'text2text-generation' or 'text-classification' or 'text-generation' or 'conversational':
|
303 |
+
# print("YO",st.session_state.task)
|
304 |
+
# st.session_state.markdown_upload = "language_model_template1.md" ## language model template
|
305 |
|
306 |
+
else:#if st.session_state.task:
|
307 |
|
308 |
st.session_state.markdown_upload = "current_card.md" ## default non language model template
|
309 |
print("st.session_state.markdown_upload",st.session_state.markdown_upload)
|
|
|
322 |
|
323 |
if submit:
|
324 |
if len(repo_id.split('/')) == 2:
|
325 |
+
repo_url = create_repo(repo_id, exist_ok=True, token=token)
|
326 |
print("repo_url",repo_url)
|
327 |
card_info = pj()
|
328 |
print(card_info)
|
current_card.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
---
|
2 |
-
|
|
|
|
|
3 |
---
|
4 |
|
5 |
# {{ model_id }}
|
|
|
1 |
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
license: openrail
|
5 |
---
|
6 |
|
7 |
# {{ model_id }}
|