Spaces:
Sleeping
Sleeping
Commit ·
e9ecdc7
1
Parent(s): b4518cd
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,6 +7,9 @@ import gradio as gr
|
|
| 7 |
SIMBALS_GLOBAL_DB = 1
|
| 8 |
SIMBALS_MAIN_DATABASE = 2
|
| 9 |
|
|
|
|
|
|
|
|
|
|
| 10 |
def process(input_path):
|
| 11 |
# setup the client
|
| 12 |
client = SimbalsAPIClient(os.environ['TOKEN'], debug=True)
|
|
@@ -38,7 +41,11 @@ def process(input_path):
|
|
| 38 |
id_spotify = x['id']
|
| 39 |
if id_spotify == -1:
|
| 40 |
id_spotify = "No Spotify ID found."
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
except IndexError:
|
| 43 |
return "Not found. Please try again."
|
| 44 |
time.sleep(1)
|
|
@@ -46,7 +53,7 @@ def process(input_path):
|
|
| 46 |
|
| 47 |
demo = gr.Interface(fn=process,
|
| 48 |
inputs=gr.Audio(type="filepath"),
|
| 49 |
-
outputs=gr.outputs.Textbox(label="Generated Text")
|
| 50 |
#examples=example_list,
|
| 51 |
#cache_examples=False
|
| 52 |
)
|
|
|
|
| 7 |
SIMBALS_GLOBAL_DB = 1
|
| 8 |
SIMBALS_MAIN_DATABASE = 2
|
| 9 |
|
| 10 |
+
embed_html1 = '<iframe src="https://open.spotify.com/embed/track/'
|
| 11 |
+
embed_html2 = '" width="300" height="380" frameborder="0" allowtransparency="true" allow="encrypted-media"></iframe>'
|
| 12 |
+
|
| 13 |
def process(input_path):
|
| 14 |
# setup the client
|
| 15 |
client = SimbalsAPIClient(os.environ['TOKEN'], debug=True)
|
|
|
|
| 41 |
id_spotify = x['id']
|
| 42 |
if id_spotify == -1:
|
| 43 |
id_spotify = "No Spotify ID found."
|
| 44 |
+
output_text = trackname+" by "+artistname + " - ISRC : " + isrc + " - spotify ID : " + id_spotify
|
| 45 |
+
|
| 46 |
+
output_html = embed_html1 + id_spotify + embed_html2
|
| 47 |
+
|
| 48 |
+
return ouput_text, output_html
|
| 49 |
except IndexError:
|
| 50 |
return "Not found. Please try again."
|
| 51 |
time.sleep(1)
|
|
|
|
| 53 |
|
| 54 |
demo = gr.Interface(fn=process,
|
| 55 |
inputs=gr.Audio(type="filepath"),
|
| 56 |
+
outputs=[gr.outputs.Textbox(label="Generated Text"),"html"]
|
| 57 |
#examples=example_list,
|
| 58 |
#cache_examples=False
|
| 59 |
)
|