mawairon commited on
Commit
5f8dde1
1 Parent(s): c1e6692

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -3
app.py CHANGED
@@ -1,7 +1,23 @@
1
  import gradio as gr
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
5
 
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
 
 
 
 
 
 
 
 
 
 
 
 
 
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()