Spaces:
Running
Running
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import pandas as pd
|
| 3 |
+
|
| 4 |
+
def display_csv(file_path):
|
| 5 |
+
# Load the CSV file using pandas
|
| 6 |
+
df = pd.read_csv(file_path)
|
| 7 |
+
# Convert the dataframe to HTML table
|
| 8 |
+
html_table = df.to_html(index=False)
|
| 9 |
+
return html_table
|
| 10 |
+
|
| 11 |
+
# Hardcoded file path
|
| 12 |
+
file_path = "merged-averaged-model_timings_2.1.0_12.1_NVIDIA_A10G_False.csv"
|
| 13 |
+
|
| 14 |
+
# Call the display_csv function with the hardcoded file path
|
| 15 |
+
html_table_output = display_csv(file_path)
|
| 16 |
+
|
| 17 |
+
# Define the output component
|
| 18 |
+
output_text = gr.outputs.HTML(label="CSV File Preview")
|
| 19 |
+
|
| 20 |
+
# Create the Gradio interface
|
| 21 |
+
gr.Interface(fn=lambda: html_table_output, inputs=None, outputs=output_text, title="CSV Viewer").launch()
|