Sabbir772 commited on
Commit
edeccf4
·
verified ·
1 Parent(s): 7d8f790

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -8,7 +8,7 @@ from peft import PeftModel
8
  # tokenizer = AutoTokenizer.from_pretrained(model_path, use_fast=False)
9
  # model = AutoModelForSeq2SeqLM.from_pretrained(model_path)
10
 
11
- model_path = "Sabbir772/BnT5Sy"
12
  tokenizer = AutoTokenizer.from_pretrained(model_path, use_fast=False)
13
  model = AutoModelForSeq2SeqLM.from_pretrained(model_path)
14
  model.eval()
@@ -19,8 +19,8 @@ model.to(device)
19
  def translate(text, source_lang):
20
  if source_lang == "Bangla":
21
  prefix = "<BN>"
22
- elif source_lang == "Sylheti":
23
- prefix = "<SY>"
24
  else:
25
  return "Invalid language selected."
26
 
@@ -37,17 +37,17 @@ def translate(text, source_lang):
37
  )
38
 
39
  return tokenizer.decode(outputs[0], skip_special_tokens=True)
40
-
41
  # Gradio interface
42
  iface = gr.Interface(
43
  fn=translate,
44
  inputs=[
45
  gr.Textbox(label="Input Text"),
46
- gr.Radio(["Bangla", "Sylheti"], label="Source Language")
47
  ],
48
  outputs=gr.Textbox(label="Translated Text"),
49
- title="Bangla ↔ Sylheti Dialect Translator (Fine-tuned T5)",
50
- description="Translate between Bangla and Sylheti using a LoRA-finetuned Flan-T5 model."
51
  )
52
 
53
  iface.launch()
 
8
  # tokenizer = AutoTokenizer.from_pretrained(model_path, use_fast=False)
9
  # model = AutoModelForSeq2SeqLM.from_pretrained(model_path)
10
 
11
+ model_path = "Sabbir772/banglat5-finetuned-bn-Ch"
12
  tokenizer = AutoTokenizer.from_pretrained(model_path, use_fast=False)
13
  model = AutoModelForSeq2SeqLM.from_pretrained(model_path)
14
  model.eval()
 
19
  def translate(text, source_lang):
20
  if source_lang == "Bangla":
21
  prefix = "<BN>"
22
+ elif source_lang == "Chatgaiya":
23
+ prefix = "<CH>"
24
  else:
25
  return "Invalid language selected."
26
 
 
37
  )
38
 
39
  return tokenizer.decode(outputs[0], skip_special_tokens=True)
40
+
41
  # Gradio interface
42
  iface = gr.Interface(
43
  fn=translate,
44
  inputs=[
45
  gr.Textbox(label="Input Text"),
46
+ gr.Radio(["Bangla", "Chatgaiya"], label="Source Language")
47
  ],
48
  outputs=gr.Textbox(label="Translated Text"),
49
+ title="Bangla ↔ Chatgaiya Dialect Translator (Fine-tuned T5)",
50
+ description="Translate between Bangla and Chatgaiya using a LoRA-finetuned model."
51
  )
52
 
53
  iface.launch()