|
import gradio as gr |
|
import pandas as pd |
|
|
|
|
|
block = gr.Blocks() |
|
|
|
def make_clickable_model(model_name, link=None): |
|
name = model_name.replace("https://huggingface.co/spaces/","") |
|
return f'<a target="_blank" href="{model_name}">{name.split("/")[-1].replace("_", " ")}</a>' |
|
|
|
def read_df(): |
|
df = pd.read_excel("demo_df.xlsx") |
|
links = [] |
|
for i in range(df.shape[0]): |
|
links.append(make_clickable_model(df.iloc[i, 2])) |
|
df.drop(columns="Link", inplace=True) |
|
df.insert(2, "Link", links) |
|
df.insert(0, "ID", list(range(1, len(df) + 1))) |
|
return df |
|
|
|
with block: |
|
gr.Markdown( |
|
"""# Detomo AI Galary 🧙♀️ 🧛♀️ 🤖 """ |
|
) |
|
galary = gr.Dataframe( |
|
type="pandas", datatype=["number", "str", "str", "markdown"] |
|
) |
|
block.load(read_df, inputs=None, outputs=galary) |
|
block.launch(share=True, debug=True) |