File size: 337 Bytes
4860f1b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import time

import gradio as gr


def slow_echo(message, history):
    """Sync generator that simulates slow token-by-token generation."""
    response = ""
    for char in message:
        time.sleep(1)  # simulate slow generation (1 token/sec)
        response += char
        yield response


gr.ChatInterface(fn=slow_echo).launch()