Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,31 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
def process_sequence(sequence, domain_bounds, n):
|
10 |
start_index = int(domain_bounds['start'][0]) - 1
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import pandas as pd
|
3 |
+
import torch
|
4 |
+
from transformers import AutoTokenizer, AutoModelForMaskedLM
|
5 |
+
import torch.nn.functional as F
|
6 |
+
import logging
|
7 |
+
import numpy as np
|
8 |
+
import matplotlib.pyplot as plt
|
9 |
+
import seaborn as sns
|
10 |
+
from io import BytesIO
|
11 |
+
from PIL import Image
|
12 |
+
from contextlib import contextmanager
|
13 |
+
import warnings
|
14 |
+
import sys
|
15 |
+
import os
|
16 |
+
import zipfile
|
17 |
+
|
18 |
+
logging.getLogger("transformers.modeling_utils").setLevel(logging.ERROR)
|
19 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
20 |
+
print(f"Using device: {device}")
|
21 |
+
|
22 |
+
# Load the tokenizer and model
|
23 |
+
model_name = "ChatterjeeLab/FusOn-pLM"
|
24 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
|
25 |
+
model = AutoModelForMaskedLM.from_pretrained(model_name, trust_remote_code=True)
|
26 |
+
model.to(device)
|
27 |
+
model.eval()
|
28 |
+
|
29 |
|
30 |
def process_sequence(sequence, domain_bounds, n):
|
31 |
start_index = int(domain_bounds['start'][0]) - 1
|