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