Spaces:
Runtime error
Runtime error
File size: 1,381 Bytes
424c611 668bd6c b8b0054 4ed7662 f33d759 668bd6c f33d759 424c611 668bd6c 424c611 668bd6c 4ed7662 668bd6c f33d759 d3a775f f33d759 88b8568 668bd6c 4ed7662 668bd6c 4ed7662 668bd6c 424c611 668bd6c 39c67b8 4ed7662 668bd6c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
import gradio as gr
import pandas as pd
# Assuming columns_to_click are the columns which contain URLs that you want to make clickable
columns_to_click = ["Paper / Repo", "Playground"]
def get_data():
# Load the CSV file into a DataFrame
df = pd.read_csv(
"https://docs.google.com/spreadsheets/d/e/2PACX-1vSC40sszorOjHfozmNqJT9lFiJhG94u3fbr3Ss_7fzcU3xqqJQuW1Ie_SNcWEB-uIsBi9NBUK7-ddet/pub?output=csv",
skiprows=1,
)
# Drop rows where the 'Model' column is NaN
df.dropna(subset=['Model'], inplace=True)
# Drop rows where the 'Parameters \n(B)' column is 'TBA'
df = df[df["Parameters \n(B)"] != "TBA"]
# Apply make_clickable_cell to the specified columns
for col in columns_to_click:
df[col] = df[col].apply(make_clickable_cell)
return df
def make_clickable_cell(cell):
if pd.isnull(cell) or not isinstance(cell, str):
return ""
else:
return f'<a target="_blank" href="{cell}">{cell}</a>'
# Load the data to get the columns for setting up datatype
dataframe = get_data()
dtypes = ["str" if c not in columns_to_click else "html" for c in dataframe.columns]
# Gradio app setup
with gr.Blocks() as demo:
# Markdown and DataFrame components
gr.Markdown(title)
gr.Markdown(description)
gr.DataFrame(get_data, datatype=dtypes, every=60)
# Launch the Gradio app
demo.launch()
|