trknxspotify / app.py
mervenoyan's picture
layout
0670634
raw
history blame
1.74 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,
x="petalWidth",
y="petalLength",
color="species",
title="Iris Dataset",
color_legend_title="Species",
x_title="Petal Width",
y_title="Petal Length",
tooltip=["petalWidth", "petalLength", "species"],
caption="",
)
##########
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")
#dataset = gr.Dropdown(choices=["cars", "iris"], value="cars")
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()
#dataset.change(scatter_plot_fn, inputs=dataset, outputs=plot)
demo.load(fn=scatter_plot_fn, outputs=plot)
demo.launch()