import csv | |
import random | |
def new_output_file(username): | |
# Generate a random 6-digit number for the filename | |
random_number = random.randint(100000, 999999) | |
filename = f'./{username}/output_{random_number}.csv' | |
# filename = f'/Users/yunshi/Downloads/360Data/Data Center/Working-On Task/演讲与培训/2023ChatGPT/Coding/gradio/中交建/产品演示DEMO/交付_文本清洗/{username}/output_{random_number}.csv' | |
# Create a new CSV file with 2 columns, ID and output. | |
with open(filename, 'w', newline='') as file: | |
writer = csv.writer(file) | |
# Write the header row | |
writer.writerow(['ID', 'output']) | |
return filename |