Update app.py
Browse files
app.py
CHANGED
@@ -10,17 +10,18 @@ from transformers import RobertaTokenizer, RobertaModel
|
|
10 |
from transformers import AutoModelForSequenceClassification
|
11 |
from transformers import TFAutoModelForSequenceClassification
|
12 |
from transformers import AutoTokenizer, AutoModelForTokenClassification
|
13 |
-
|
14 |
import matplotlib.pyplot as plt
|
15 |
import sys
|
16 |
import csv
|
17 |
-
|
18 |
csv.field_size_limit(sys.maxsize)
|
19 |
|
20 |
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
21 |
|
22 |
-
tokenizer = AutoTokenizer.from_pretrained("
|
23 |
-
model = AutoModelForSequenceClassification.from_pretrained("
|
|
|
24 |
# build a pipeline object to do predictions
|
25 |
pred = transformers.pipeline("text-classification", model=model,
|
26 |
tokenizer=tokenizer, return_all_scores=True)
|
@@ -137,4 +138,4 @@ with gr.Blocks(title=title) as demo:
|
|
137 |
# , med, sym
|
138 |
], main, cache_examples=True)
|
139 |
|
140 |
-
|
|
|
10 |
from transformers import AutoModelForSequenceClassification
|
11 |
from transformers import TFAutoModelForSequenceClassification
|
12 |
from transformers import AutoTokenizer, AutoModelForTokenClassification
|
13 |
+
|
14 |
import matplotlib.pyplot as plt
|
15 |
import sys
|
16 |
import csv
|
17 |
+
|
18 |
csv.field_size_limit(sys.maxsize)
|
19 |
|
20 |
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
21 |
|
22 |
+
tokenizer = AutoTokenizer.from_pretrained("MarkAdamsMSBA24/ADRv2024")
|
23 |
+
model = AutoModelForSequenceClassification.from_pretrained("MarkAdamsMSBA24/ADRv2024").to(device)
|
24 |
+
|
25 |
# build a pipeline object to do predictions
|
26 |
pred = transformers.pipeline("text-classification", model=model,
|
27 |
tokenizer=tokenizer, return_all_scores=True)
|
|
|
138 |
# , med, sym
|
139 |
], main, cache_examples=True)
|
140 |
|
141 |
+
demo.launch()
|