kadirnar commited on
Commit
3e36f52
1 Parent(s): ce22bda

Update app.py

Browse files

I updated the example codes.

Files changed (1) hide show
  1. app.py +12 -5
app.py CHANGED
@@ -19,8 +19,8 @@ def load_model(model_name="BioGPT"):
19
  "BioGPT-QA-PubMedQA-BioGPT":"microsoft/BioGPT-Large-PubMedQA"
20
  }
21
 
22
- tokenizer = BioGptTokenizer.from_pretrained("microsoft/biogpt")
23
- model = BioGptForCausalLM.from_pretrained("microsoft/biogpt")
24
  return tokenizer, model
25
 
26
 
@@ -39,18 +39,25 @@ def get_beam_output(sentence, selected_model, min_len=100,max_len=512, n_beams=1
39
 
40
  inputs = [
41
  gr.inputs.Textbox(label="prompt", lines=5, default="Bicalutamide"),
42
- gr.Dropdown(model_names, value="microsoft/biogpt", label="selected_model"),
43
  gr.inputs.Slider(1, 500, 1, default=100, label="min_len"),
44
  gr.inputs.Slider(1, 2048, 1, default=1024, label="max_len"),
45
  gr.inputs.Slider(1, 10, 1, default=5, label="num_beams")
46
  ]
 
47
  outputs = gr.outputs.Textbox(label="output")
48
 
 
 
 
 
 
 
49
  iface = gr.Interface(
50
  fn=get_beam_output,
51
  inputs=inputs,
52
  outputs=outputs,
53
- examples=[["Bicalutamide"], ["Janus kinase 3 (JAK-3)"], ["Apricitabine"], ["Xylazine"], ["Psoralen"], ["CP-673451"]]
 
54
  )
55
-
56
  iface.launch(debug=True, enable_queue=True)
 
19
  "BioGPT-QA-PubMedQA-BioGPT":"microsoft/BioGPT-Large-PubMedQA"
20
  }
21
 
22
+ tokenizer = BioGptTokenizer.from_pretrained(model_name_map[model_name])
23
+ model = BioGptForCausalLM.from_pretrained(model_name_map[model_name])
24
  return tokenizer, model
25
 
26
 
 
39
 
40
  inputs = [
41
  gr.inputs.Textbox(label="prompt", lines=5, default="Bicalutamide"),
42
+ gr.Dropdown(model_names, value="BioGPT", label="selected_model"),
43
  gr.inputs.Slider(1, 500, 1, default=100, label="min_len"),
44
  gr.inputs.Slider(1, 2048, 1, default=1024, label="max_len"),
45
  gr.inputs.Slider(1, 10, 1, default=5, label="num_beams")
46
  ]
47
+
48
  outputs = gr.outputs.Textbox(label="output")
49
 
50
+ examples = [
51
+ ["Bicalutamide", "BioGPT", 25, 100, 5],
52
+ ["Janus kinase 3 (JAK-3)", "BioGPT", 25, 100, 5],
53
+ ["Apricitabine", "BioGPT", 25, 100, 5],
54
+ ]
55
+
56
  iface = gr.Interface(
57
  fn=get_beam_output,
58
  inputs=inputs,
59
  outputs=outputs,
60
+ examples=examples,
61
+ title="BioGPT: generative pre-trained transformer for biomedical text generation and mining"
62
  )
 
63
  iface.launch(debug=True, enable_queue=True)