Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
demo = gr.Blocks()
|
4 |
+
|
5 |
+
name_list = ['huggingface/microsoft/biogpt', 'huggingface/stanford-crfm/BioMedLM']
|
6 |
+
|
7 |
+
examples = [
|
8 |
+
['COVID is'],
|
9 |
+
]
|
10 |
+
|
11 |
+
def generate_biomedical(text):
|
12 |
+
interfaces = [gr.Interface.load(name) for name in name_list]
|
13 |
+
return [interface(text) for interface in interfaces]
|
14 |
+
|
15 |
+
def set_example(example: list) -> dict:
|
16 |
+
return gr.Textbox.update(value=example[0])
|
17 |
+
|
18 |
+
with gr.Blocks() as demo:
|
19 |
+
gr.Markdown("# Compare generative biomedical LLMs")
|
20 |
+
with gr.Box():
|
21 |
+
with gr.Row():
|
22 |
+
with gr.Column():
|
23 |
+
input_text = gr.Textbox(label = "Write your text here", lines=4)
|
24 |
+
with gr.Row():
|
25 |
+
btn = gr.Button("Generate ✨")
|
26 |
+
|
27 |
+
example_text = gr.Dataset(components=[input_text], samples=examples)
|
28 |
+
example_text.click(fn=set_example,
|
29 |
+
inputs = example_text,
|
30 |
+
outputs= example_text.components)
|
31 |
+
with gr.Column():
|
32 |
+
gr.Markdown("Let’s compare!")
|
33 |
+
btn.click(generate_biomedical, inputs = input_text, outputs = [gr.Textbox(label=name_list[_], lines=4) for _ in range(len(name_list))])
|