Spaces:
				
			
			
	
			
			
					
		Running
		
	
	
	
			
			
	
	
	
	
		
		
					
		Running
		
	| import gradio as gr | |
| from transformers import pipeline | |
| checkpoint = "Swekerr/eng2hindi" | |
| translate = pipeline("translation", model=checkpoint) | |
| def translate_text(text): | |
| result = translate(text, max_length=512) | |
| return result[0]['translation_text'] | |
| with gr.Blocks() as demo: | |
| gr.Markdown("# English to Hindi Translator") | |
| gr.Markdown("Enter English text below and get the Hindi translation.") | |
| with gr.Row(): | |
| input_text = gr.Textbox(label="Input English Text", placeholder="Type something in English...") | |
| output_text = gr.Textbox(label="Translated Hindi Text", interactive=False) | |
| translate_button = gr.Button("Translate") | |
| translate_button.click(translate_text, inputs=[input_text], outputs=[output_text]) | |
| demo.launch() | |
