aneesqumar commited on
Commit
9514122
·
verified ·
1 Parent(s): 4298dc5

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -0
app.py ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import pandas as pd
3
+
4
+ # ---------------------------------
5
+ # Load Dataset
6
+ # ---------------------------------
7
+ def load_iris_data():
8
+ try:
9
+ df = pd.read_csv("Iris.csv")
10
+ return df.head(5)
11
+ except Exception as e:
12
+ return pd.DataFrame({"Error": [str(e)]})
13
+
14
+ # ---------------------------------
15
+ # Gradio UI
16
+ # ---------------------------------
17
+ with gr.Blocks() as demo:
18
+ gr.Markdown(
19
+ """
20
+ # 🌸 Iris Dataset Viewer
21
+ Click the button below to display the **first 5 rows** of the dataset.
22
+ """
23
+ )
24
+
25
+ load_button = gr.Button("Show First 5 Rows", variant="primary")
26
+
27
+ output_table = gr.Dataframe(
28
+ label="Iris Dataset (First 5 Rows)",
29
+ interactive=False
30
+ )
31
+
32
+ load_button.click(
33
+ fn=load_iris_data,
34
+ outputs=output_table
35
+ )
36
+
37
+ demo.launch()