fix typing (#8942)

This commit is contained in:
Abubakar Abid 2024-07-30 13:06:13 -07:00 committed by GitHub
parent 8204425bfa
commit 716bf94ff5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 5 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@ -184,7 +184,7 @@ with demo:
)
leaderboard_table = gr.components.Dataframe(
value=df[ON_LOAD_COLS],
value=df[ON_LOAD_COLS], # type: ignore
headers=ON_LOAD_COLS,
datatype=TYPES,
elem_id="leaderboard-table",
@ -195,7 +195,7 @@ with demo:
# Dummy leaderboard for handling the case when the user uses backspace key
hidden_leaderboard_table_for_search = gr.components.Dataframe(
value=invisible_df[COLS],
value=invisible_df[COLS], # type: ignore
headers=COLS,
datatype=TYPES,
visible=False,

View File

@ -1 +1 @@
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: timer_simple"]}, {"cell_type": "code", "execution_count": null, "id": "272996653310673477252411125948039410165", "metadata": {}, "outputs": [], "source": ["!pip install -q gradio "]}, {"cell_type": "code", "execution_count": null, "id": "288918539441861185822528903084949547379", "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "import random\n", "import time\n", "\n", "with gr.Blocks() as demo:\n", " timer = gr.Timer(1)\n", " timestamp = gr.Number(label=\"Time\")\n", " timer.tick(lambda: round(time.time()), outputs=timestamp)\n", "\n", " number = gr.Number(lambda: random.randint(1, 10), every=timer, label=\"Random Number\")\n", " with gr.Row():\n", " gr.Button(\"Start\").click(lambda: gr.Timer(active=True), None, timer)\n", " gr.Button(\"Stop\").click(lambda: gr.Timer(active=False), None, timer)\n", " gr.Button(\"Go Fast\").click(0.2, None, timer)\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: timer_simple"]}, {"cell_type": "code", "execution_count": null, "id": "272996653310673477252411125948039410165", "metadata": {}, "outputs": [], "source": ["!pip install -q gradio "]}, {"cell_type": "code", "execution_count": null, "id": "288918539441861185822528903084949547379", "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "import random\n", "import time\n", "\n", "with gr.Blocks() as demo:\n", " timer = gr.Timer(1)\n", " timestamp = gr.Number(label=\"Time\")\n", " timer.tick(lambda: round(time.time()), outputs=timestamp)\n", "\n", " number = gr.Number(lambda: random.randint(1, 10), every=timer, label=\"Random Number\")\n", " with gr.Row():\n", " gr.Button(\"Start\").click(lambda: gr.Timer(active=True), None, timer)\n", " gr.Button(\"Stop\").click(lambda: gr.Timer(active=False), None, timer)\n", " gr.Button(\"Go Fast\").click(lambda: 0.2, None, timer)\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}

View File

@ -11,7 +11,7 @@ with gr.Blocks() as demo:
with gr.Row():
gr.Button("Start").click(lambda: gr.Timer(active=True), None, timer)
gr.Button("Stop").click(lambda: gr.Timer(active=False), None, timer)
gr.Button("Go Fast").click(0.2, None, timer)
gr.Button("Go Fast").click(lambda: 0.2, None, timer)
if __name__ == "__main__":
demo.launch()