Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import matplotlib.pyplot as plt
|
3 |
+
|
4 |
+
def plot_price_trends(prices_data):
|
5 |
+
models = [item['model'] for item in prices_data]
|
6 |
+
prices = [float(item['price'].replace('₴', '').strip()) for item in prices_data]
|
7 |
+
|
8 |
+
plt.figure(figsize=(10, 6))
|
9 |
+
plt.plot(models, prices, marker='o', color='b')
|
10 |
+
plt.title('Price Trends of Shoes')
|
11 |
+
plt.xlabel('Models')
|
12 |
+
plt.ylabel('Price (₴)')
|
13 |
+
plt.xticks(rotation=45)
|
14 |
+
plt.tight_layout()
|
15 |
+
return plt
|
16 |
+
|
17 |
+
with gr.Blocks() as demo:
|
18 |
+
gr.Markdown("### Price Trends Visualization")
|
19 |
+
price_data = gr.Dataframe(headers=["Store", "Model", "Price"])
|
20 |
+
plot_button = gr.Button("Plot Trends")
|
21 |
+
output = gr.Plot()
|
22 |
+
|
23 |
+
plot_button.click(plot_price_trends, inputs=price_data, outputs=output)
|
24 |
+
|
25 |
+
demo.launch()
|