Spotify / app.py
Tristan Thrush
added dataframe sample values
801318e
raw
history blame
1.62 kB
import gradio as gr
import spotipy
###########
from vega_datasets import data
iris = data.iris()
def scatter_plot_fn(dataset):
return gr.ScatterPlot(
value=iris
)
##########
def get_started():
# redirects to spotify and comes back
# then generates plots
return
with gr.Blocks() as demo:
gr.Markdown(" ## Spotify Analyzer 🥳🎉")
gr.Markdown("This app analyzes how cool your music taste is. We dare you to take this challenge!")
with gr.Row():
get_started_btn = gr.Button("Get Started")
with gr.Row():
with gr.Column():
with gr.Row():
with gr.Column():
plot = gr.ScatterPlot(show_label=False).style(container=True)
with gr.Column():
plot = gr.ScatterPlot(show_label=False).style(container=True)
with gr.Row():
with gr.Column():
plot = gr.ScatterPlot(show_label=False).style(container=True)
with gr.Column():
plot = gr.ScatterPlot(show_label=False).style(container=True)
with gr.Row():
gr.Markdown(" ### We have recommendations for you!")
with gr.Row():
gr.Dataframe(
headers=["Song", "Album", "Artist"],
datatype=["str", "str", "str"],
label="Reccomended Songs",
value=[["something", "something", "something"], ["something", "something", "something"]] # TODO: replace with actual reccomendations once get_started() is implemeted.
)
demo.load(fn=scatter_plot_fn, outputs=plot)
demo.launch()