adf0d17497
publish / version_or_publish (push) Waiting to run
storybook-build / changes (push) Waiting to run
storybook-build / :storybook-build (push) Blocked by required conditions
Sync Gradio Skills to Hugging Face / sync-skills (push) Waiting to run
functional / changes (push) Waiting to run
functional / build-frontend (push) Blocked by required conditions
functional / functional-test-SSR=false (push) Blocked by required conditions
functional / functional-reload (push) Blocked by required conditions
functional / functional-test-SSR=true (push) Blocked by required conditions
hygiene / hygiene-test (push) Waiting to run
python / changes (push) Waiting to run
python / build (push) Blocked by required conditions
python / test-ubuntu-latest-flaky (push) Blocked by required conditions
python / test-ubuntu-latest-not-flaky (push) Blocked by required conditions
python / test-windows-latest-flaky (push) Blocked by required conditions
python / test-windows-latest-not-flaky (push) Blocked by required conditions
js / changes (push) Waiting to run
js / js-test (push) Blocked by required conditions
docs-build / changes (push) Waiting to run
docs-build / docs-build (push) Blocked by required conditions
docs-build / website-build (push) Blocked by required conditions
29 lines
767 B
Python
29 lines
767 B
Python
import gradio as gr
|
|
import time
|
|
|
|
runs = 0
|
|
|
|
def reset_runs():
|
|
global runs
|
|
runs = 0
|
|
|
|
def slow_echo(message, history):
|
|
global runs # i didn't want to add state or anything to this demo
|
|
runs = runs + 1
|
|
for i in range(len(message)):
|
|
time.sleep(0.02)
|
|
yield f"Run {runs} - You typed: " + message[: i + 1]
|
|
|
|
chat = gr.ChatInterface(slow_echo, fill_height=True, editable=True, api_name="chat")
|
|
|
|
with gr.Blocks() as demo:
|
|
chat.render()
|
|
# We reset the global variable to minimize flakes
|
|
# this works because CI runs only one test at at time
|
|
# need to use gr.State if we want to parallelize this test
|
|
# currently chatinterface does not support that
|
|
demo.unload(reset_runs)
|
|
|
|
if __name__ == "__main__":
|
|
demo.launch()
|