24Sureshkumar commited on
Commit
b4aa913
Β·
verified Β·
1 Parent(s): 391969d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -5,12 +5,13 @@ import torch
5
 
6
  @st.cache_resource
7
  def load_all_models():
8
- # Load Tamil ➝ English translation model
9
  translation_pipeline = pipeline(
10
  "translation",
11
  model="ai4bharat/indictrans2-indic-en-dist-200M",
12
  tokenizer="ai4bharat/indictrans2-indic-en-dist-200M",
13
  src_lang="ta", tgt_lang="en",
 
14
  device=0 if torch.cuda.is_available() else -1,
15
  )
16
 
@@ -24,6 +25,7 @@ def load_all_models():
24
 
25
  return translation_pipeline, img_pipe
26
 
 
27
  def main():
28
  st.set_page_config(page_title="Tamil ➝ English ➝ Image", layout="centered")
29
  st.title("🌐 Tamil to English to Image Generator")
 
5
 
6
  @st.cache_resource
7
  def load_all_models():
8
+ # Load Tamil ➝ English translation model (with remote code)
9
  translation_pipeline = pipeline(
10
  "translation",
11
  model="ai4bharat/indictrans2-indic-en-dist-200M",
12
  tokenizer="ai4bharat/indictrans2-indic-en-dist-200M",
13
  src_lang="ta", tgt_lang="en",
14
+ trust_remote_code=True, # πŸ”₯ Must add this
15
  device=0 if torch.cuda.is_available() else -1,
16
  )
17
 
 
25
 
26
  return translation_pipeline, img_pipe
27
 
28
+
29
  def main():
30
  st.set_page_config(page_title="Tamil ➝ English ➝ Image", layout="centered")
31
  st.title("🌐 Tamil to English to Image Generator")