Spaces:
Sleeping
Sleeping
File size: 445 Bytes
12c8edb 78c1489 5d2f16c 78c1489 b001989 6e78182 12c8edb b001989 78c1489 b001989 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import random
import time
import gradio as gr
from transformers import pipeline
translator = pipeline("translation", model=f'Broomva/bart-large-translation-spa-guc')
def slow_echo(message, history):
translated = translator(message)[0]['translation_text']
for i in range(len(translated)):
time.sleep(0.05)
yield translated[: i+1]
demo = gr.ChatInterface(slow_echo).queue()
if __name__ == "__main__":
demo.launch() |