Spaces:
Sleeping
Sleeping
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() | |