Spaces:
Sleeping
Sleeping
Fix deps
Browse files- app.py +2 -18
- packages.txt +4 -1
app.py
CHANGED
@@ -1,20 +1,4 @@
|
|
1 |
-
|
2 |
-
from functools import partial
|
3 |
-
|
4 |
-
import numpy as np
|
5 |
-
|
6 |
-
import matplotlib.pyplot as plt
|
7 |
-
import seaborn as sns
|
8 |
-
|
9 |
-
from sentence_transformers import SentenceTransformer
|
10 |
-
import torch
|
11 |
-
import tqdm
|
12 |
-
|
13 |
-
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, pipeline
|
14 |
-
import penman
|
15 |
-
from collections import Counter, defaultdict
|
16 |
-
import networkx as nx
|
17 |
-
from networkx.drawing.nx_agraph import pygraphviz_layout
|
18 |
|
19 |
from transformers import pipeline
|
20 |
from functools import partial
|
@@ -129,7 +113,7 @@ class FramingDimensions:
|
|
129 |
class FramingStructure:
|
130 |
def __init__(self, base_model, roles=None):
|
131 |
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
132 |
-
|
133 |
|
134 |
def __call__(self, sequence_to_translate):
|
135 |
res = self.translator(sequence_to_translate)
|
|
|
1 |
+
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
from transformers import pipeline
|
4 |
from functools import partial
|
|
|
113 |
class FramingStructure:
|
114 |
def __init__(self, base_model, roles=None):
|
115 |
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
116 |
+
self.translator = pipeline("text2text-generation", base_model, device=device, max_length=300)
|
117 |
|
118 |
def __call__(self, sequence_to_translate):
|
119 |
res = self.translator(sequence_to_translate)
|
packages.txt
CHANGED
@@ -1 +1,4 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
1 |
+
python3-dev
|
2 |
+
graphviz
|
3 |
+
libgraphviz-dev
|
4 |
+
pkg-config
|