Spaces:
Sleeping
Sleeping
Upload create_newfile.py
Browse files- create_newfile.py +16 -0
create_newfile.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import csv
|
2 |
+
import random
|
3 |
+
|
4 |
+
def new_output_file(username):
|
5 |
+
# Generate a random 6-digit number for the filename
|
6 |
+
random_number = random.randint(100000, 999999)
|
7 |
+
filename = f'/Users/yunshi/Downloads/360Data/Data Center/Working-On Task/演讲与培训/2023ChatGPT/Coding/gradio/中交建/产品演示DEMO/交付_文本清洗/{username}/output_{random_number}.csv'
|
8 |
+
|
9 |
+
# Create a new CSV file with 2 columns, ID and output.
|
10 |
+
with open(filename, 'w', newline='') as file:
|
11 |
+
writer = csv.writer(file)
|
12 |
+
|
13 |
+
# Write the header row
|
14 |
+
writer.writerow(['ID', 'output'])
|
15 |
+
|
16 |
+
return filename
|