Spaces:
Runtime error
Runtime error
File size: 1,048 Bytes
ed9c614 6e05fea ed9c614 6e05fea ed9c614 e59973f 6e05fea 8c0443d ed9c614 8c0443d ed9c614 8c0443d ed9c614 8c0443d ed9c614 8c0443d 6e05fea |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# import gradio as gr
# from transformers import pipeline
# def translate(text,number):
# model1=''
# if number==1:
# model1='Helsinki-NLP/opus-mt-en-es'
# elif number==2:
# model1='Helsinki-NLP/opus-mt-en-fr'
# else:
# model1='Helsinki-NLP/opus-mt-en-ru'
# pipe=pipeline("translation", model=model1)
# return pipe(text)[0]["translation_text"]
# demo = gr.Interface(fn=translate, inputs=["text","number"], outputs="json")
# demo.launch()
# import gradio as gr
# from transformers import pipeline
# pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-en-ru")
# def predict(text):
# return pipe(text)[0]["translation_text"]
# demo = gr.Interface(
# fn=predict,
# inputs='text',
# outputs='text',
# )
# demo.launch()
import gradio as gr
with gr.Blocks() as demo:
with gr.Tab("Translate to Spanish"):
gr.load("gradio/helsinki_translation_en_es", src="spaces")
with gr.Tab("Translate to French"):
gr.load("abidlabs/en2fr", src="spaces")
demo.launch() |