Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,6 +13,10 @@ from huggingface_hub import hf_hub_download
|
|
| 13 |
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
|
| 14 |
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
# Cacher le nom du repo
|
| 17 |
python_path = hf_hub_download(repo_id=os.environ['REPO_ID'], repo_type="space", filename=os.environ['MODEL_FILE'],
|
| 18 |
use_auth_token=os.environ['TOKEN'])
|
|
@@ -46,18 +50,35 @@ def process(prompt, lang):
|
|
| 46 |
#for i in range(len(I[0])):
|
| 47 |
# print(audio_names[I[0][i]], " with distance ", D[0][i])
|
| 48 |
# print(" url : ", get_url_myma(I[0][i], audio_names, url_dict))
|
| 49 |
-
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
audio_names[I[0][1]].split('.')[0], get_url_myma(I[0][1], audio_names, url_dict),
|
| 52 |
audio_names[I[0][2]].split('.')[0], get_url_myma(I[0][2], audio_names, url_dict),
|
| 53 |
audio_names[I[0][3]].split('.')[0], get_url_myma(I[0][3], audio_names, url_dict),
|
| 54 |
audio_names[I[0][4]].split('.')[0], get_url_myma(I[0][4], audio_names, url_dict)]
|
| 55 |
except:
|
| 56 |
-
return ["
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
|
|
|
| 61 |
|
| 62 |
inputs = [gr.Textbox(label="Input", value="type your description", max_lines=2),
|
| 63 |
gr.Radio(label="Language", choices=["en"], value="en")]
|
|
@@ -83,7 +104,8 @@ poc_examples = [
|
|
| 83 |
["90 eurodance beat","en"],
|
| 84 |
]
|
| 85 |
|
| 86 |
-
outputs = [gr.
|
|
|
|
| 87 |
gr.Textbox(label="Track name 2"), gr.Audio(label="Track 2", show_label=False),
|
| 88 |
gr.Textbox(label="Track name 3"), gr.Audio(label="Track 3", show_label=False),
|
| 89 |
gr.Textbox(label="Track name 4"), gr.Audio(label="Track 4", show_label=False),
|
|
|
|
| 13 |
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
|
| 14 |
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
|
| 15 |
|
| 16 |
+
max_results = 100
|
| 17 |
+
max_output = 50
|
| 18 |
+
|
| 19 |
+
|
| 20 |
# Cacher le nom du repo
|
| 21 |
python_path = hf_hub_download(repo_id=os.environ['REPO_ID'], repo_type="space", filename=os.environ['MODEL_FILE'],
|
| 22 |
use_auth_token=os.environ['TOKEN'])
|
|
|
|
| 50 |
#for i in range(len(I[0])):
|
| 51 |
# print(audio_names[I[0][i]], " with distance ", D[0][i])
|
| 52 |
# print(" url : ", get_url_myma(I[0][i], audio_names, url_dict))
|
| 53 |
+
|
| 54 |
+
formated = []
|
| 55 |
+
output_csv = f"{file_name}_results_text.csv"
|
| 56 |
+
with open(output_csv, "w") as w:
|
| 57 |
+
writer = csv.writer(w)
|
| 58 |
+
count = 0
|
| 59 |
+
for top in tops:
|
| 60 |
+
if count > max_output:
|
| 61 |
+
break
|
| 62 |
+
|
| 63 |
+
formated.append(file)
|
| 64 |
+
formated.append(top)
|
| 65 |
+
#writer.writerow(dict_catalog[file].values())
|
| 66 |
+
count += 1
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
return [output_csv,
|
| 70 |
+
audio_names[I[0][0]].split('.')[0], get_url_myma(I[0][0], audio_names, url_dict),
|
| 71 |
audio_names[I[0][1]].split('.')[0], get_url_myma(I[0][1], audio_names, url_dict),
|
| 72 |
audio_names[I[0][2]].split('.')[0], get_url_myma(I[0][2], audio_names, url_dict),
|
| 73 |
audio_names[I[0][3]].split('.')[0], get_url_myma(I[0][3], audio_names, url_dict),
|
| 74 |
audio_names[I[0][4]].split('.')[0], get_url_myma(I[0][4], audio_names, url_dict)]
|
| 75 |
except:
|
| 76 |
+
return ["",
|
| 77 |
+
"Error input - please try again", "",
|
| 78 |
+
"Error input - please try again", "",
|
| 79 |
+
"Error input - please try again", "",
|
| 80 |
+
"Error input - please try again", "",
|
| 81 |
+
"Error input - please try again", "",]
|
| 82 |
|
| 83 |
inputs = [gr.Textbox(label="Input", value="type your description", max_lines=2),
|
| 84 |
gr.Radio(label="Language", choices=["en"], value="en")]
|
|
|
|
| 104 |
["90 eurodance beat","en"],
|
| 105 |
]
|
| 106 |
|
| 107 |
+
outputs = [gr.File(),
|
| 108 |
+
gr.Textbox(label="Track name 1"), gr.Audio(label="Track 1", show_label=False),
|
| 109 |
gr.Textbox(label="Track name 2"), gr.Audio(label="Track 2", show_label=False),
|
| 110 |
gr.Textbox(label="Track name 3"), gr.Audio(label="Track 3", show_label=False),
|
| 111 |
gr.Textbox(label="Track name 4"), gr.Audio(label="Track 4", show_label=False),
|