Spaces:
Runtime error
Runtime error
Language translation
Browse filesFiles changed (2)
- app.py+13-6
- requirements.txt+2-1
1234567891011121314import gradio as grdef greet(name):return f"Hello, {name}!"demo = gr.Interface(fn=greet,inputs=gr.Textbox(label="Enter your name"),outputs="text",title="Hello World!",description="Enter your name to get a personalized greeting",)demo.launch()123456789101112131415161718192021import gradio as grfrom transformers import pipeline# Initialize a pipeline for translationtranslator = pipeline("translation_en-to-hi")def translate(text):# Translate the text from English to Hinditranslation = translator(text)[0]["translation_text"]return translationdemo = gr.Interface(fn=translate,inputs=gr.Textbox(label="Enter English text"),outputs="text",title="English to Hindi Translation",description="Enter English text to translate it to Hindi",)demo.launch()
1huggingface_hub==0.22.212torchtransformers
app.py+13-6
requirements.txt+2-1