Spaces:
Runtime error
Runtime error
Update app.py (#1)
Browse files- Update app.py (3e36f5267b0b9100d42034e1b038175abe3bef4e)
Co-authored-by: Kadir Nar <[email protected]>
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(
|
23 |
-
model = BioGptForCausalLM.from_pretrained(
|
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="
|
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=
|
|
|
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)
|