Akariieieie commited on
Commit
2f0018e
·
verified ·
1 Parent(s): ff01de5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -9
app.py CHANGED
@@ -2,19 +2,13 @@ import gradio as gr
2
  import torch
3
  from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
4
 
5
- # 1. Define paths
6
- # We load the base configuration and weights from the official hub,
7
- # but point the model to load your local folder ("./") for the PEFT adapter layers.
8
  model_path = "Akariieieie/DialectGo-NLLB"
9
 
10
  print(f"Loading fully fine-tuned DialectGo model from hub: {model_path}...")
11
  tokenizer = AutoTokenizer.from_pretrained(model_path)
12
  model = AutoModelForSeq2SeqLM.from_pretrained(model_path)
13
 
14
- print("Merging your fine-tuned DialectGo adapter layers...")
15
- # This automatically spots adapter_config.json in your root and snaps it on
16
- model.load_adapter(adapter_path)
17
-
18
  # 2. Map display names to NLLB-200 language codes
19
  LANG_CODES = {
20
  "English": "eng_Latn",
@@ -42,8 +36,8 @@ def translate_text(text, target_lang_name):
42
 
43
  # 3. Build the UI Layout
44
  with gr.Blocks(theme=gr.themes.Base()) as demo:
45
- gr.Markdown("# 🇵🇭 DialectGo Translator (LoRA Fine-Tuned)")
46
- gr.Markdown("Translate seamlessly between English, Tagalog, and Cebuano using your adapter-optimized NLLB model.")
47
 
48
  with gr.Row():
49
  with gr.Column():
 
2
  import torch
3
  from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
4
 
5
+ # 1. Load your fully merged standalone model and tokenizer from your Model Repo
 
 
6
  model_path = "Akariieieie/DialectGo-NLLB"
7
 
8
  print(f"Loading fully fine-tuned DialectGo model from hub: {model_path}...")
9
  tokenizer = AutoTokenizer.from_pretrained(model_path)
10
  model = AutoModelForSeq2SeqLM.from_pretrained(model_path)
11
 
 
 
 
 
12
  # 2. Map display names to NLLB-200 language codes
13
  LANG_CODES = {
14
  "English": "eng_Latn",
 
36
 
37
  # 3. Build the UI Layout
38
  with gr.Blocks(theme=gr.themes.Base()) as demo:
39
+ gr.Markdown("# 🇵🇭 DialectGo Translator")
40
+ gr.Markdown("Translate seamlessly between English, Tagalog, and Cebuano using your fully fine-tuned standalone NLLB model.")
41
 
42
  with gr.Row():
43
  with gr.Column():