AItool commited on
Commit
0176ebb
·
verified ·
1 Parent(s): c68ce0c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -8,8 +8,8 @@ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, MarianMTModel, Ma
8
  DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
9
 
10
  MODEL_OPTIONS = [
11
- "FLAN-T5-base (Google en→en)",
12
- "Helsinki-NLP" # Round-trip OPUS-MT en→es→en
13
  ]
14
 
15
  # Cache
@@ -69,7 +69,7 @@ def polish(sentence: str, choice: str) -> str:
69
  return "Unknown option."
70
 
71
  # --- Gradio UI ---
72
- with gr.Blocks(title="English Grammar Polisher") as demo:
73
  gr.Markdown("### English Grammar Polisher\nChoose FLAN-T5 (Google) or OPUS-MT (Helsinki-NLP).")
74
  inp = gr.Textbox(lines=3, label="Input (English) E.g. She go tomorrow buy two bread.", placeholder="Type an English sentence to correct.")
75
  choice = gr.Dropdown(choices=MODEL_OPTIONS, value="FLAN-T5-base (Google)", label="Method")
 
8
  DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
9
 
10
  MODEL_OPTIONS = [
11
+ "Helsinki-NLP", # Round-trip OPUS-MT en→es→en
12
+ "FLAN-T5-base (Google en→en)"
13
  ]
14
 
15
  # Cache
 
69
  return "Unknown option."
70
 
71
  # --- Gradio UI ---
72
+ with gr.Blocks(title="English Grammar Polisher (CPU enabled)") as demo:
73
  gr.Markdown("### English Grammar Polisher\nChoose FLAN-T5 (Google) or OPUS-MT (Helsinki-NLP).")
74
  inp = gr.Textbox(lines=3, label="Input (English) E.g. She go tomorrow buy two bread.", placeholder="Type an English sentence to correct.")
75
  choice = gr.Dropdown(choices=MODEL_OPTIONS, value="FLAN-T5-base (Google)", label="Method")