Spaces:
Build error
Build error
Upload 4 files
Browse files- Convert_Parquet_to_CSV.py +23 -0
- Convert_Parquet_to_Excel.py +23 -0
- Gradio Text Differences.py +46 -0
- Upload_Repo_to-Github.bat +11 -0
Convert_Parquet_to_CSV.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#remove the hashtags from lines 3, 4, and 5 the first time you run this script to install the required packages
|
| 2 |
+
|
| 3 |
+
#pip install pandas
|
| 4 |
+
#pip install pyarrow
|
| 5 |
+
#pip install openpyxl
|
| 6 |
+
|
| 7 |
+
import pandas as pd
|
| 8 |
+
|
| 9 |
+
# Update the paths below to where your files are located in your Windows Downloads folder
|
| 10 |
+
input_parquet_path = r'c:\Users\username\Downloads\FILENAME.parquet' # Update this to your file's path
|
| 11 |
+
output_csv_path = r'c:\Users\username\Downloads\output.csv' # Update this to your desired output path
|
| 12 |
+
|
| 13 |
+
# NOW YOU CAN RUN THE SCRIPT
|
| 14 |
+
|
| 15 |
+
# THE OUTPUT FILE WILL BE LOCATED IN YOUR WINDOWS DOWNLOADS FOLDER BY DEFAULT
|
| 16 |
+
|
| 17 |
+
# Reading the Parquet file
|
| 18 |
+
df = pd.read_parquet(input_parquet_path)
|
| 19 |
+
|
| 20 |
+
# Writing to an CSV file
|
| 21 |
+
df.to_csv(output_csv_path, index=False)
|
| 22 |
+
|
| 23 |
+
print(f"Successfully converted {input_parquet_path} to {output_csv_path}")
|
Convert_Parquet_to_Excel.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#remove the hashtags from lines 3, 4, and 5 the first time you run this script to install the required packages
|
| 2 |
+
|
| 3 |
+
#pip install pandas
|
| 4 |
+
#pip install pyarrow
|
| 5 |
+
#pip install openpyxl
|
| 6 |
+
|
| 7 |
+
import pandas as pd
|
| 8 |
+
|
| 9 |
+
# Update the paths below to where your files are located in your Windows Downloads folder
|
| 10 |
+
input_parquet_path = r'c:\Users\username\Downloads\FILENAME.parquet' # Update this to your file's path
|
| 11 |
+
output_excel_path = r'c:\Users\username\Downloads\output.xlsx' # Update this to your desired output path
|
| 12 |
+
|
| 13 |
+
# NOW YOU CAN RUN THE SCRIPT
|
| 14 |
+
|
| 15 |
+
# THE OUTPUT FILE WILL BE LOCATED IN YOUR WINDOWS DOWNLOADS FOLDER BY DEFAULT
|
| 16 |
+
|
| 17 |
+
# Reading the Parquet file
|
| 18 |
+
df = pd.read_parquet(input_parquet_path)
|
| 19 |
+
|
| 20 |
+
# Writing to an Excel file
|
| 21 |
+
df.to_excel(output_excel_path, index=False)
|
| 22 |
+
|
| 23 |
+
print(f"Successfully converted {input_parquet_path} to {output_excel_path}")
|
Gradio Text Differences.py
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
!pip install gradio
|
| 2 |
+
!pip import difflib
|
| 3 |
+
|
| 4 |
+
from difflib import Differ
|
| 5 |
+
|
| 6 |
+
import gradio as gr
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
def diff_texts(text1, text2):
|
| 10 |
+
d = Differ()
|
| 11 |
+
return [
|
| 12 |
+
(token[2:], token[0] if token[0] != " " else None)
|
| 13 |
+
for token in d.compare(text1, text2)
|
| 14 |
+
]
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
demo = gr.Interface(
|
| 18 |
+
diff_texts,
|
| 19 |
+
[
|
| 20 |
+
gr.Textbox(
|
| 21 |
+
label="Text 1",
|
| 22 |
+
info="Initial text",
|
| 23 |
+
lines=3,
|
| 24 |
+
|
| 25 |
+
# INSERT TEXT ONE
|
| 26 |
+
|
| 27 |
+
value="The quick brown fox jumped over the lazy dogs.",
|
| 28 |
+
),
|
| 29 |
+
gr.Textbox(
|
| 30 |
+
label="Text 2",
|
| 31 |
+
info="Text to compare",
|
| 32 |
+
lines=3,
|
| 33 |
+
# INSERT TEXT TWO
|
| 34 |
+
|
| 35 |
+
value="The fast brown fox jumps over lazy dogs.",
|
| 36 |
+
),
|
| 37 |
+
],
|
| 38 |
+
gr.HighlightedText(
|
| 39 |
+
label="Diff",
|
| 40 |
+
combine_adjacent=True,
|
| 41 |
+
show_legend=True,
|
| 42 |
+
color_map={"+": "red", "-": "green"}),
|
| 43 |
+
theme=gr.themes.Base()
|
| 44 |
+
)
|
| 45 |
+
if __name__ == "__main__":
|
| 46 |
+
demo.launch()
|
Upload_Repo_to-Github.bat
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
cd [LOCATION]
|
| 2 |
+
|
| 3 |
+
git init
|
| 4 |
+
|
| 5 |
+
git add .
|
| 6 |
+
|
| 7 |
+
git commit -m "Initial commit"
|
| 8 |
+
|
| 9 |
+
git remote add origin [HTTPS]
|
| 10 |
+
|
| 11 |
+
git push -u origin master
|