import time | |
import gradio as gr | |
def timer(stringNum, history): | |
try: | |
num = int(stringNum) | |
yield stringNum | |
while num > 0: | |
yield str(num) | |
time.sleep(1) | |
num -= 1 | |
yield "0 - Countdown done!" | |
except ValueError: | |
yield "Error: Message not int." | |
demo = gr.ChatInterface(timer).queue() | |
if __name__ == "__main__": | |
demo.launch() | |