File size: 762 Bytes
5abdc2c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from datasets import load_dataset
import pandas as pd

dataset = load_dataset("vivym/midjourney-prompts")

df = dataset['train'].to_pandas()

prompt_lengths = df['prompt'].str.len()
p50 = prompt_lengths.quantile(0.90)
p75 = prompt_lengths.quantile(1.0)

filtered_df = df[(prompt_lengths > p50) & (prompt_lengths <= p75) & (df['style'] != 'niji') & (df['is_upscaled'] == True) & (df['version'] >= 5.0) & (df['version'] <= 5.2)]

filtered_df = filtered_df.drop_duplicates(subset=['prompt'])

print(f"Number of prompts after filtering and deduplication: {len(filtered_df)}")

print("First few rows of the filtered dataset:")
print(filtered_df.head())

output_file = 'filtered_midjourney_prompts_80thpercentilelength.csv'
filtered_df.to_csv(output_file, index=False)