Spaces:
Sleeping
Sleeping
File size: 816 Bytes
c1e6692 5f8dde1 c1e6692 5f8dde1 c1e6692 5f8dde1 c1e6692 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import gradio as gr
from transformers import AutoTokenizer, AutoModelForSequenceClassification
# Load the Hugging Face model and tokenizer
model_name = 'AIRI-Institute/gena-lm-bert-base-lastln-t2t' # Replace with the actual model name
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
# Define a function to process the DNA sequence
def analyze_dna(sequence):
# Preprocess the input sequence
inputs = tokenizer(sequence, return_tensors='pt')
# Get model predictions
outputs = model(**inputs)
predictions = outputs.logits.argmax(dim=-1).item()
return f"Prediction: {predictions}"
# Create a Gradio interface
demo = gr.Interface(fn=analyze_dna, inputs="text", outputs="text")
# Launch the interface
demo.launch()
|