VedantJhunthra commited on
Commit
606a773
·
verified ·
1 Parent(s): 4058c97

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +22 -0
  2. requirements.txt +4 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Load the translation pipeline
5
+ translator = pipeline("translation_en_to_fr", model="AventIQ-AI/t5-text-translator")
6
+
7
+ def translate(text):
8
+ result = translator(text)
9
+ return result[0]['translation_text']
10
+
11
+ # Create Gradio interface
12
+ iface = gr.Interface(
13
+ fn=translate,
14
+ inputs=gr.Textbox(lines=5, placeholder="Enter English text here..."),
15
+ outputs=gr.Textbox(label="Translated French Text"),
16
+ title="English to French Translator",
17
+ description="Translate English text into French using the T5 model fine-tuned by AventIQ.",
18
+ )
19
+
20
+ # Launch the app
21
+ if __name__ == "__main__":
22
+ iface.launch()
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ torch
2
+ transformers
3
+ sentencepiece
4
+ gradio