File size: 784 Bytes
a0aaf13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import os
import gradio as gr
from transformers import pipeline

name_list = ['microsoft/biogpt']

examples = [['COVID-19 is'],['A 65-year-old female patient with a past medical history of']] 

pipe_biogpt = pipeline("text-generation", model="microsoft/biogpt")

title = "BioGPT Demo"
description = "Disclaimer: this demo was made for research purposes only and should not be used for medical purposes.\nModel: [BioGPT](https://huggingface.co/microsoft/biogpt)."

def inference(text):
  output_biogpt = pipe_biogpt(text, max_length=100)[0]["generated_text"]
  return [
      output_biogpt, 
  ]

io = gr.Interface(
  inference,
  gr.Textbox(lines=3),
  outputs=[
    gr.Textbox(lines=3, label="BioGPT"),
  ],
  title=title,
  description=description,
  examples=examples
)
io.launch()