Spaces:
Build error
Build error
| import torch | |
| import mistral as Mistral | |
| device = "cuda" if torch.cuda.is_available() else "cpu" | |
| song = ["\"And We Run (feat. Xzibit)\" by Within Temptation and Xzibit"] | |
| top_ten = [ | |
| "\"Angels\" by Within Temptation", | |
| "\"Stand My Ground\" by Within Temptation", | |
| "\"The Gathering\" by Delain", | |
| "\"April Rain\" by Delain", | |
| "\"Strange Machines\" by The Gathering", | |
| "\"We Are the Others\" by Delain", | |
| "\"See Me In Shadow\" by Delain", | |
| "\"Leaves\" by The Gathering", | |
| "\"Saturnine\" by The Gathering", | |
| "\"Frozen\" by Delain" | |
| ] | |
| next_ten = [ | |
| "\'No More\" by Nemesea", | |
| "\"Eleanor\" by The Gathering", | |
| "\"In Motion #1\" by The Gathering", | |
| "\"The Evil that Men Do - Remastered\" by After Forever", | |
| "\"In Control\" by Nemesea", | |
| "\"Allein - Bonus Track\" by Nemasea", | |
| "\"Colder\" by End of the Dream", | |
| "\"Summertime Sadness\" by Within Temptation", | |
| "\"Sinéad - Benno de Goeij Remix\" by Within Temptation and Benno De Goeij", | |
| "\"Sinéad - Alex M.O.R.P.H. Radio Edit\" by Within Temptation and Alex M.O.R.P.H" | |
| ] | |
| selected = [ | |
| "\"Take Me Home, Country Roads\" by John Denver", | |
| "\"Take On Me\" by a-ha", | |
| "\"Africa\" by Toto" | |
| ] | |
| if __name__ == '__main__': | |
| me = Mistral.MistralExplainer(device) | |
| print("\n#=#=#=#=#=#\n") | |
| me.explain_why(song, top_ten) | |
| print(me.get_positive_explanations()) | |
| print("\n#=#=#=#=#=#\n") | |
| me.explain_why_these_arent_top(song, top_ten, next_ten) | |
| print(me.get_constrastive_explanations()) | |
| print("\n#=#=#=#=#=#\n") | |
| me.explain_why_not_these_songs(song, top_ten, selected) | |
| print(me.get_other_constrastive_explanations()) | |
| print("\n#=#=#=#=#=#\n") | |
| ## |