Spaces:
Running
Running
from transformers import pipeline, set_seed | |
from transformers import BioGptTokenizer, BioGptForCausalLM | |
import gradio as gr | |
model = BioGptForCausalLM.from_pretrained("microsoft/biogpt") | |
tokenizer = BioGptTokenizer.from_pretrained("microsoft/biogpt") | |
generator = pipeline('text-generation', model=model, tokenizer=tokenizer) | |
set_seed(42) | |
def predict(text): | |
return generator(text, max_length=20, num_return_sequences=1, do_sample=True) | |
interface = gr.Interface(predict, "textbox", "textbox", title="Biogpt", description="Biogpt") | |
interface.launch() |