Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,11 +8,13 @@ from gradio.themes.monochrome import Monochrome
|
|
| 8 |
from gradio.themes.default import Default
|
| 9 |
from gradio.themes.utils import colors, fonts, sizes
|
| 10 |
|
|
|
|
| 11 |
import torch
|
| 12 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification, AutoModelForTokenClassification, pipeline
|
| 13 |
import os
|
| 14 |
import colorsys
|
| 15 |
import time
|
|
|
|
| 16 |
def hex_to_rgb(hex_color: str) -> tuple[int, int, int]:
|
| 17 |
hex_color = hex_color.lstrip('#')
|
| 18 |
return tuple(int(hex_color[i:i+2], 16) for i in (0, 2, 4))
|
|
@@ -107,6 +109,7 @@ tokenizer1 = AutoTokenizer.from_pretrained("AlGe/deberta-v3-large_Int_segment",
|
|
| 107 |
|
| 108 |
model2 = AutoModelForSequenceClassification.from_pretrained("AlGe/deberta-v3-large_seq_ext", num_labels=1, token=auth_token)
|
| 109 |
|
|
|
|
| 110 |
# Define functions to process inputs
|
| 111 |
def process_ner(text, pipeline):
|
| 112 |
output = pipeline(text)
|
|
|
|
| 8 |
from gradio.themes.default import Default
|
| 9 |
from gradio.themes.utils import colors, fonts, sizes
|
| 10 |
|
| 11 |
+
import spaces
|
| 12 |
import torch
|
| 13 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification, AutoModelForTokenClassification, pipeline
|
| 14 |
import os
|
| 15 |
import colorsys
|
| 16 |
import time
|
| 17 |
+
|
| 18 |
def hex_to_rgb(hex_color: str) -> tuple[int, int, int]:
|
| 19 |
hex_color = hex_color.lstrip('#')
|
| 20 |
return tuple(int(hex_color[i:i+2], 16) for i in (0, 2, 4))
|
|
|
|
| 109 |
|
| 110 |
model2 = AutoModelForSequenceClassification.from_pretrained("AlGe/deberta-v3-large_seq_ext", num_labels=1, token=auth_token)
|
| 111 |
|
| 112 |
+
@spaces.GPU
|
| 113 |
# Define functions to process inputs
|
| 114 |
def process_ner(text, pipeline):
|
| 115 |
output = pipeline(text)
|