mirror of
https://github.com/gradio-app/gradio.git
synced 2024-11-21 01:01:05 +08:00
fix typing (#8942)
This commit is contained in:
parent
8204425bfa
commit
716bf94ff5
File diff suppressed because one or more lines are too long
@ -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,
|
||||
|
@ -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}
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user