Spaces:
Sleeping
Sleeping
import gradio as gr | |
from transformers import pipeline, set_seed | |
from transformers import BioGptTokenizer, BioGptForCausalLM | |
model = BioGptForCausalLM.from_pretrained("microsoft/biogpt") | |
tokenizer = BioGptTokenizer.from_pretrained("microsoft/biogpt") | |
generator = pipeline('text-generation', model=model, tokenizer=tokenizer) | |
set_seed(42) | |
def biogpt_promot(inpt): | |
return generator(inpt, max_length=20, num_return_sequences=5, do_sample=True) | |
#def hello(name): | |
# return "hello " + name + "!" | |
app = gr.Interface(fn=biogpt_promot, inputs="text", outputs="text") | |
app.launch() |