dnabert2-demo / app.py
Zhu Lin
update
d0a4a1f unverified
raw
history blame contribute delete
499 Bytes
from transformers import AutoTokenizer, AutoModel, pipeline
from transformers.models.bert.configuration_bert import BertConfig
import gradio as gr
config = BertConfig.from_pretrained("czl/dnabert2")
tokenizer = AutoTokenizer.from_pretrained("czl/dnabert2", trust_remote_code=True)
model = AutoModel.from_pretrained("czl/dnabert2", trust_remote_code=True, config=config)
pipe = pipeline("feature-extraction", model=model, tokenizer=tokenizer)
demo = gr.Interface.from_pipeline(pipe)
demo.launch()