Commit
·
0670634
1
Parent(s):
0d5194e
layout
Browse files
app.py
CHANGED
@@ -1,8 +1,59 @@
|
|
1 |
import gradio as gr
|
2 |
import spotipy
|
3 |
|
4 |
-
def greet(name):
|
5 |
-
return "Hello " + name + "!!"
|
6 |
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
import spotipy
|
3 |
|
|
|
|
|
4 |
|
5 |
+
###########
|
6 |
+
|
7 |
+
from vega_datasets import data
|
8 |
+
|
9 |
+
iris = data.iris()
|
10 |
+
|
11 |
+
|
12 |
+
def scatter_plot_fn(dataset):
|
13 |
+
return gr.ScatterPlot(
|
14 |
+
value=iris,
|
15 |
+
x="petalWidth",
|
16 |
+
y="petalLength",
|
17 |
+
color="species",
|
18 |
+
title="Iris Dataset",
|
19 |
+
color_legend_title="Species",
|
20 |
+
x_title="Petal Width",
|
21 |
+
y_title="Petal Length",
|
22 |
+
tooltip=["petalWidth", "petalLength", "species"],
|
23 |
+
caption="",
|
24 |
+
)
|
25 |
+
|
26 |
+
|
27 |
+
##########
|
28 |
+
def get_started():
|
29 |
+
# redirects to spotify and comes back
|
30 |
+
# then generates plots
|
31 |
+
return
|
32 |
+
|
33 |
+
with gr.Blocks() as demo:
|
34 |
+
gr.Markdown(" ## Spotify Analyzer 🥳🎉")
|
35 |
+
gr.Markdown("This app analyzes how cool your music taste is. We dare you to take this challenge!")
|
36 |
+
with gr.Row():
|
37 |
+
get_started_btn = gr.Button("Get Started")
|
38 |
+
#dataset = gr.Dropdown(choices=["cars", "iris"], value="cars")
|
39 |
+
with gr.Row():
|
40 |
+
with gr.Column():
|
41 |
+
with gr.Row():
|
42 |
+
with gr.Column():
|
43 |
+
plot = gr.ScatterPlot(show_label=False).style(container=True)
|
44 |
+
with gr.Column():
|
45 |
+
plot = gr.ScatterPlot(show_label=False).style(container=True)
|
46 |
+
with gr.Row():
|
47 |
+
with gr.Column():
|
48 |
+
plot = gr.ScatterPlot(show_label=False).style(container=True)
|
49 |
+
with gr.Column():
|
50 |
+
plot = gr.ScatterPlot(show_label=False).style(container=True)
|
51 |
+
with gr.Row():
|
52 |
+
gr.Markdown(" ### We have recommendations for you!")
|
53 |
+
with gr.Row():
|
54 |
+
gr.DataFrame()
|
55 |
+
#dataset.change(scatter_plot_fn, inputs=dataset, outputs=plot)
|
56 |
+
demo.load(fn=scatter_plot_fn, outputs=plot)
|
57 |
+
|
58 |
+
|
59 |
+
demo.launch()
|