Saboorhsn commited on
Commit
833a07b
·
verified ·
1 Parent(s): 30585ac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -2,6 +2,7 @@ import streamlit as st
2
  from datasets import load_dataset, concatenate_datasets
3
  import json
4
  import os
 
5
 
6
  def load_and_combine_datasets():
7
  python_codes_dataset = load_dataset('flytech/python-codes-25k', split='train')
@@ -41,8 +42,8 @@ def main():
41
  file_path = os.path.join(os.getcwd(), f"{output_dataset_name}.jsonl")
42
  save_combined_dataset_as_jsonl(combined_dataset, file_path)
43
  st.write("Download the combined dataset as JSONL file:")
44
- with open(file_path, "rb") as f:
45
- bytes_data = f.read()
46
  b64 = base64.b64encode(bytes_data).decode()
47
  href = f'<a href="data:file/jsonl;base64,{b64}" download="{output_dataset_name}.jsonl">Download JSONL File</a>'
48
  st.markdown(href, unsafe_allow_html=True)
 
2
  from datasets import load_dataset, concatenate_datasets
3
  import json
4
  import os
5
+ import base64 # Add base64 for encoding
6
 
7
  def load_and_combine_datasets():
8
  python_codes_dataset = load_dataset('flytech/python-codes-25k', split='train')
 
42
  file_path = os.path.join(os.getcwd(), f"{output_dataset_name}.jsonl")
43
  save_combined_dataset_as_jsonl(combined_dataset, file_path)
44
  st.write("Download the combined dataset as JSONL file:")
45
+ with open(file_path, "r") as f: # Open file in read mode
46
+ bytes_data = f.read().encode() # Encode the data as bytes
47
  b64 = base64.b64encode(bytes_data).decode()
48
  href = f'<a href="data:file/jsonl;base64,{b64}" download="{output_dataset_name}.jsonl">Download JSONL File</a>'
49
  st.markdown(href, unsafe_allow_html=True)