Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# gradio_plot.py
|
| 2 |
+
|
| 3 |
+
import gradio as gr
|
| 4 |
+
import pandas as pd
|
| 5 |
+
import seaborn as sns
|
| 6 |
+
import matplotlib.pyplot as plt
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
def plot_pens(place_holder):
|
| 10 |
+
"""scatter plot penguin chars using matplotlib""" # plotly doesn't work as of 2.8.7, targeted for 2.9
|
| 11 |
+
|
| 12 |
+
df_pens = pd.read_csv(
|
| 13 |
+
"https://raw.githubusercontent.com/mwaskom/seaborn-data/master/penguins.csv"
|
| 14 |
+
)
|
| 15 |
+
fig = plt.figure()
|
| 16 |
+
plt.scatter(x=df_pens["bill_length_mm"], y=df_pens["bill_depth_mm"])
|
| 17 |
+
return fig
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
iface = gr.Interface(
|
| 21 |
+
fn=plot_pens,
|
| 22 |
+
layout="vertical",
|
| 23 |
+
inputs=["checkbox"],
|
| 24 |
+
outputs=["plot"],
|
| 25 |
+
title="Scatterplot of Palmer Penguins",
|
| 26 |
+
description="Let's talk pens. Click to see a plot.",
|
| 27 |
+
article="Talk more about Penguins here, shall we?",
|
| 28 |
+
theme="peach",
|
| 29 |
+
live=True,
|
| 30 |
+
).launch()
|