File size: 408 Bytes
af23863
 
 
8e3c97e
62c3616
 
 
 
 
40a98c7
62c3616
 
 
 
af23863
62c3616
af23863
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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()