Ezi Ozoani commited on
Commit
d5f027a
β€’
1 Parent(s): 4a057f9

landing page addtion

Browse files
Files changed (2) hide show
  1. 1_πŸ“_form.py +20 -4
  2. about.md +4 -0
1_πŸ“_form.py CHANGED
@@ -11,6 +11,8 @@ 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():
16
  languages_df = pd.read_html("https://hf.co/languages")[0]
@@ -94,7 +96,10 @@ def save_uploadedfile(uploadedfile):
94
  st.success("Saved File:{} to temp_uploaded_filed_Dir".format(uploadedfile.name))
95
  return uploadedfile.name
96
 
97
- def main():
 
 
 
98
  if "model_name" not in st.session_state:
99
  # Initialize session state.
100
  st.session_state.update({
@@ -277,10 +282,21 @@ def main():
277
  download_status = st.download_button(label = 'Download Model Card', data = pj(), file_name = downloaded_file_name, help = "The current model card will be downloaded as a markdown (.md) file")
278
  if download_status == True:
279
  st.success("Your current model card, successfully downloaded πŸ€—")
280
-
281
 
282
-
 
 
 
 
 
 
 
 
 
 
283
 
284
  if __name__ == '__main__':
285
  load_widget_state()
286
- main()
 
 
 
11
  import os
12
  from middleMan import parse_into_jinja_markdown as pj
13
 
14
+
15
+
16
  @st.cache
17
  def get_cached_data():
18
  languages_df = pd.read_html("https://hf.co/languages")[0]
 
96
  st.success("Saved File:{} to temp_uploaded_filed_Dir".format(uploadedfile.name))
97
  return uploadedfile.name
98
 
99
+
100
+ def main_page():
101
+
102
+
103
  if "model_name" not in st.session_state:
104
  # Initialize session state.
105
  st.session_state.update({
 
282
  download_status = st.download_button(label = 'Download Model Card', data = pj(), file_name = downloaded_file_name, help = "The current model card will be downloaded as a markdown (.md) file")
283
  if download_status == True:
284
  st.success("Your current model card, successfully downloaded πŸ€—")
 
285
 
286
+
287
+ def page_switcher(page):
288
+ st.session_state.runpage = page
289
+
290
+ def main():
291
+
292
+ st.header("About Model Cards")
293
+ st.markdown(Path('about.md').read_text(), unsafe_allow_html=True)
294
+ btn = st.button('Create a Model Card πŸ“',on_click=page_switcher,args=(main_page,))
295
+ if btn:
296
+ st.experimental_rerun() # rerun is needed to clear the page
297
 
298
  if __name__ == '__main__':
299
  load_widget_state()
300
+ if 'runpage' not in st.session_state :
301
+ st.session_state.runpage = main
302
+ st.session_state.runpage()
about.md ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+
2
+ This is a tool to generate Model Cards. It aims to provide a simple interface to build from scratch a new model card or to edit an existing one. The generated model card can be downloaded or directly pushed to your model hosted on the Hub. Please use [the Community tab](https://huggingface.co/spaces/huggingface/Model_Cards_Writing_Tool/discussions) to give us some feedback πŸ€—
3
+
4
+