sohailq commited on
Commit
1d64def
1 Parent(s): 0a9c3d5

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+ from space import Space
4
+
5
+ # Load the Space model for English to Urdu translation
6
+ space = Space("Helsinki-NLP/opus-mt-en-ur")
7
+
8
+ # Create a Gradio interface for the translation app
9
+ def translate(text):
10
+ # Use the Space model to translate the input text
11
+ result = space.translate(text)
12
+ return result
13
+
14
+ input_text = gr.inputs.Textbox(label="Input English Text")
15
+ output_text = gr.outputs.Textbox(label="Output Urdu Text")
16
+ app = gr.Interface(fn=translate, inputs=input_text, outputs=output_text)
17
+
18
+ # Launch the app
19
+ app.launch()
20
+
21
+