ambreshrc commited on
Commit
4cd28f3
1 Parent(s): d9d284e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -2,7 +2,8 @@ import streamlit as st
2
  from io import BytesIO
3
  # import gradio as gr
4
  # Def_04 Docx file to translated_Docx file
5
- from transformers import MarianMTModel, MarianTokenizer
 
6
  import nltk
7
  from nltk.tokenize import sent_tokenize
8
  from nltk.tokenize import LineTokenizer
@@ -55,8 +56,8 @@ def btTranslator(docxfile):
55
  st.spinner('Wait for it...')
56
  sleep(0.5)
57
  # mname = '/content/drive/MyDrive/Transformers Models/opus-mt-en-hi-Trans Model'
58
- tokenizer = MarianTokenizer.from_pretrained(lang)
59
- model = MarianMTModel.from_pretrained(lang)
60
  model.to(device)
61
  lt = LineTokenizer()
62
  batch_size = 8
 
2
  from io import BytesIO
3
  # import gradio as gr
4
  # Def_04 Docx file to translated_Docx file
5
+ #from transformers import MarianMTModel, MarianTokenizer
6
+ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
7
  import nltk
8
  from nltk.tokenize import sent_tokenize
9
  from nltk.tokenize import LineTokenizer
 
56
  st.spinner('Wait for it...')
57
  sleep(0.5)
58
  # mname = '/content/drive/MyDrive/Transformers Models/opus-mt-en-hi-Trans Model'
59
+ tokenizer = AutoTokenizer.from_pretrained(lang)
60
+ model = AutoModelForSeq2SeqLM.from_pretrained(lang)
61
  model.to(device)
62
  lt = LineTokenizer()
63
  batch_size = 8