awacke1 commited on
Commit
effce00
·
1 Parent(s): 877125d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +39 -1
app.py CHANGED
@@ -30,8 +30,17 @@ if uploaded_file is not None:
30
  report = ProfileReport(df, explorative=True)
31
  st.header("Data profiling")
32
  st.write("Data distribution:")
33
- st.markdown(report)
34
 
 
 
 
 
 
 
 
 
 
35
  # Download link for example data
36
  example_csv = """name,age,income
37
  Alice,25,50000
@@ -41,3 +50,32 @@ csv_filename = "example.csv"
41
  b64 = base64.b64encode(example_csv.encode()).decode()
42
  href = f'<a href="data:file/csv;base64,{b64}" download="{csv_filename}">Download example data</a>'
43
  st.markdown(href, unsafe_allow_html=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  report = ProfileReport(df, explorative=True)
31
  st.header("Data profiling")
32
  st.write("Data distribution:")
33
+ #st.markdown(report)
34
 
35
+ # Display report:
36
+ report.to_file("./index.html")
37
+
38
+ path_or_fileobj ="./index.html"
39
+
40
+ # Streamlit magic:
41
+ report
42
+
43
+
44
  # Download link for example data
45
  example_csv = """name,age,income
46
  Alice,25,50000
 
50
  b64 = base64.b64encode(example_csv.encode()).decode()
51
  href = f'<a href="data:file/csv;base64,{b64}" download="{csv_filename}">Download example data</a>'
52
  st.markdown(href, unsafe_allow_html=True)
53
+
54
+ # HuggingFace Hub Demo - Model Cards from Template
55
+ from pathlib import Path
56
+ from huggingface_hub import ModelCard, ModelCardData
57
+
58
+ # Define your jinja template
59
+ template_text = """
60
+ ---
61
+ {{ card_data }}
62
+ ---
63
+
64
+ # Model Card for MyCoolModel
65
+
66
+ This model does this and that.
67
+
68
+ This model was created by [@{{ author }}](https://hf.co/{{author}}).
69
+ """.strip()
70
+
71
+ # Write the template to a file
72
+ Path('custom_template.md').write_text(template_text)
73
+
74
+ # Define card metadata
75
+ card_data = ModelCardData(language='en', license='mit', library_name='keras')
76
+
77
+ # Create card from template, passing it any jinja template variables you want.
78
+ # In our case, we'll pass author
79
+ card = ModelCard.from_template(card_data, template_path='custom_template.md', author='nateraw')
80
+ card.save('my_model_card_1.md')
81
+ print(card)