Spaces:
Running
Running
Commit
·
0fd2cd1
1
Parent(s):
75fffe6
make torch grt
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import os
|
2 |
import json
|
3 |
import gradio as gr
|
4 |
-
import torch
|
5 |
import spaces
|
6 |
from gliner import GLiNER
|
7 |
from gliner.multitask import GLiNERRelationExtractor
|
@@ -29,10 +29,10 @@ TYPE2RELS = {
|
|
29 |
print("Loading NER+RE model...")
|
30 |
model = GLiNER.from_pretrained(data_model_id, cache_dir=CACHE_DIR)
|
31 |
relation_extractor = GLiNERRelationExtractor(model=model)
|
32 |
-
if torch.cuda.is_available():
|
33 |
-
|
34 |
-
|
35 |
-
print("Models loaded.")
|
36 |
|
37 |
# Inference pipeline
|
38 |
def inference_pipeline(
|
|
|
1 |
import os
|
2 |
import json
|
3 |
import gradio as gr
|
4 |
+
# import torch
|
5 |
import spaces
|
6 |
from gliner import GLiNER
|
7 |
from gliner.multitask import GLiNERRelationExtractor
|
|
|
29 |
print("Loading NER+RE model...")
|
30 |
model = GLiNER.from_pretrained(data_model_id, cache_dir=CACHE_DIR)
|
31 |
relation_extractor = GLiNERRelationExtractor(model=model)
|
32 |
+
# if torch.cuda.is_available():
|
33 |
+
# model.to("cuda")
|
34 |
+
# relation_extractor.model.to("cuda")
|
35 |
+
# print("Models loaded.")
|
36 |
|
37 |
# Inference pipeline
|
38 |
def inference_pipeline(
|