Download modify.py from pratikstar/doesitchug: direct link, hf CLI and curl.
- Browser
- Download file 4.04 kB
-
https://huggingface.co/datasets/pratikstar/doesitchug/resolve/main/modify.py
- Command line
-
hf download hf://datasets/pratikstar/doesitchug/modify.py
-
curl -L -o modify.py https://huggingface.co/datasets/pratikstar/doesitchug/resolve/main/modify.py
4.04 kB
| import pandas as pd | |
| # Load the CSV file | |
| file_path = "/Users/pratik.sutar/Desktop/supplementary material for NLP4MusA 2024/timbre annotations/timbre-dataset.csv" | |
| df = pd.read_csv(file_path) | |
| presetsById = { | |
| '00001': '01A US Double Nrm', | |
| '00002': '01B Essex A30', | |
| '00003': '01C Brit Plexi Jump', | |
| '00004': '01D Cali Rectifire', | |
| '00005': '02A US Deluxe Nrm', | |
| '00006': '02B A30 Fawn Nrm', | |
| '00007': '02C Revv Gen Purple', | |
| '00008': '02D Revv Gen Red', | |
| '00009': '03A Archetype Clean', | |
| '00010': '03B Matchstick Ch1', | |
| '00011': '03C Brit 2204', | |
| '00012': '03D Archetype Lead', | |
| '00013': '04A Jazz Rivet 120', | |
| '00014': '04B Fullerton Brt', | |
| '00015': '04C Brit J45 Brt', | |
| '00016': '04D Solo Lead OD', | |
| '00017': '05A Placater Clean', | |
| '00018': '05B Interstate Zed', | |
| '00019': '05C Placater Dirty', | |
| '00020': '05D PV Panama', | |
| '00021': '06A Cali Texas Ch 1', | |
| '00022': '06B Essex A15', | |
| '00023': '06C Derailed Ingrid', | |
| '00024': '06D German Mahadeva', | |
| '00025': '07A WhoWatt 100', | |
| '00026': '07B Line 6 Litigator', | |
| '00027': '07C Cartographer', | |
| '00028': '07D ANGL Meteor', | |
| '00029': '08A US Small Tweed', | |
| '00030': '08B Divided Duo', | |
| '00031': '08C Brit P75 Brt', | |
| '00032': '08D Line 6 Badonk', | |
| '00033': '09A DI', | |
| '00034': '09B BAS_SVT-4 Pro', | |
| '00035': '09C BAS_Cali Bass', | |
| '00036': '09D BAS_Aqua 51', | |
| '00037': '10A BAS_Cougar 800', | |
| '00038': '10B BAS_SVT Nrm', | |
| '00039': '10C BAS_Cali 400 Ch1', | |
| '00040': '10D BAS_Del Sol 300', | |
| '00041': '11A BAS_Woody Blue', | |
| '00042': '11B Trademark', | |
| '00043': '11C AUS Flood', | |
| '00044': '11D Justice Fo Y_all', | |
| '00045': '12A Lonely Hearts', | |
| '00046': '12B Pull Me Under', | |
| '00047': '12C Stone Cold Loco', | |
| '00048': '12D Plush Garden', | |
| '00049': '13A Cowboys from DFW', | |
| '00050': '13B G.O.A.T Rodeo', | |
| '00051': '13C BIG DUBB', | |
| '00052': '13D BIG VENUE DRIVE', | |
| '00053': '14A BUBBLE NEST', | |
| '00054': '14B DUSTED', | |
| '00055': '14C SUNRISE DRIVE', | |
| '00056': '14D GLISTEN', | |
| '00057': '15A WATERS IN HELL', | |
| '00058': '15B FAUX 7 STG CHUG', | |
| '00059': '15C RICHEESE', | |
| '00060': '15D RC REINCARNATION', | |
| '00061': '16A RIFFS AND BEARDS', | |
| '00062': '16B FELIX MARK IV', | |
| '00063': '16C FELIX JAZZ 120', | |
| '00064': '16D FELIX DELUXE MOD', | |
| '00065': '17A FELIX ENGL', | |
| '00066': '17B SPOTLIGHTS', | |
| '00067': '17C BUMBLE ACOUSTIC', | |
| '00068': '17D BMBLFOOT PRINCE', | |
| '00069': '18A SHEEHAN PEARCE', | |
| '00070': '18B SHEEHAN SVT4PRO', | |
| '00071': '18C THE BLUE AGAVE', | |
| '00072': '18D BULB RHYTHM', | |
| '00073': '19A BULB LEAD', | |
| '00074': '19B BULB CLEAN', | |
| '00075': '19C BULB AMBIENT', | |
| '00076': '19D EMPTY GARBAGE', | |
| '00077': '20A ONLY GARBAGE', | |
| '00078': '20B GARBAGE BASS', | |
| '00079': '20C BILLY KASTODON', | |
| '00080': '20D THIS IS THE END' | |
| } | |
| def change_path(clipid): | |
| presetid, segmentid = clipid.split("-") | |
| filename = "data/audio_files/" + clipid + " " + presetsById[presetid] + ".wav" | |
| return filename | |
| def str_to_list(x: str): | |
| x = x.strip().strip('[').strip(']') | |
| if len(x) == 0: | |
| return [] | |
| x = x.replace("'", "").replace(" ", "") | |
| x = x.split(",") | |
| return x | |
| # Replace the values in 'clip_a' and 'clip_b' with file paths | |
| audio_dir = "audio_files/" # Directory containing the audio files | |
| df['clip_a'] = df['clip_a'].apply(lambda x: change_path(x)) | |
| df['clip_b'] = df['clip_b'].apply(lambda x: change_path(x)) | |
| df['answer'] = df['answer'].apply(lambda x: "Clip A" if x == "clip_a" else "Clip B") | |
| df['others'] = df['others'].apply(lambda x: str_to_list(x)) | |
| df = df.rename(columns={'clip_a': 'Clip-A', 'clip_b': 'Clip-B', 'attribute': 'Adjective', 'reg_ts_formattted': 'Timestamp', 'answer': 'Answer', | |
| 'cust_attr': 'Free-style-Adjectives', 'others': 'Label-Annotations'}) | |
| print(df.columns) | |
| print(df.iloc[0]) | |
| # Save the modified DataFrame (optional, for verification) | |
| df.to_csv("./updated_timbre_dataset.csv", index=False) | |