#!/usr/bin/env python from __future__ import annotations import gradio as gr import pandas as pd from demo_list import DemoList TITLE = "# List of hysts' Spaces" demo_list = DemoList() COLUMN_NAMES = [ 'title', 'arxiv', 'likes', 'tags', 'last_modified', 'created', 'sdk', 'sdk_version', 'status', 'hardware', ] COLUMN_DATATYPES = [ 'markdown', 'markdown', 'markdown', 'number', 'str', 'str', 'str', 'str', 'str', 'str', 'str', ] DEFAULT_COLUMNS = [ 'title', 'arxiv', 'likes', 'tags', 'status', 'hardware', ] def update_df() -> pd.DataFrame: demo_list.update_data() return demo_list.df with gr.Blocks(css='style.css') as demo: gr.Markdown(TITLE) df = gr.Dataframe(value=demo_list.df, datatype=COLUMN_DATATYPES, type='pandas') refresh_button = gr.Button('Refresh') refresh_button.click(fn=update_df, outputs=df) demo.queue(api_open=False).launch()