Spaces:
Sleeping
Sleeping
seriouspark
commited on
Commit
โข
c638b7d
1
Parent(s):
dc66c9b
Update app.py
Browse files
app.py
CHANGED
@@ -39,38 +39,6 @@ def get_sent_labeldata():
|
|
39 |
idx2emo = {v : k[1] for k, v in emo2idx.items()}
|
40 |
return emo2idx, idx2emo
|
41 |
|
42 |
-
# def load_model():
|
43 |
-
|
44 |
-
# class BertClassifier(nn.Module):
|
45 |
-
|
46 |
-
# def __init__(self, dropout = 0.3):
|
47 |
-
# super(BertClassifier, self).__init__()
|
48 |
-
|
49 |
-
# self.bert= BertModel.from_pretrained('bert-base-multilingual-cased')
|
50 |
-
# self.dropout = nn.Dropout(dropout)
|
51 |
-
# self.linear = nn.Linear(768, 6)
|
52 |
-
# self.relu = nn.ReLU()
|
53 |
-
|
54 |
-
# def forward(self, input_id, mask):
|
55 |
-
# _, pooled_output = self.bert(input_ids = input_id, attention_mask = mask, return_dict = False)
|
56 |
-
# dropout_output = self.dropout(pooled_output)
|
57 |
-
# linear_output = self.linear(dropout_output)
|
58 |
-
# final_layer= self.relu(linear_output)
|
59 |
-
|
60 |
-
# return final_layer
|
61 |
-
|
62 |
-
|
63 |
-
# tokenizer = AutoTokenizer.from_pretrained('bert-base-multilingual-cased')
|
64 |
-
# device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
65 |
-
# cls_model = BertClassifier()
|
66 |
-
# criterion = nn.CrossEntropyLoss()
|
67 |
-
# model_name = 'bert-base-multilingual-cased'
|
68 |
-
# PATH = './model' + '/' + model_name + '_' + '2023102410'
|
69 |
-
# print(PATH)
|
70 |
-
# cls_model = torch.load(PATH)
|
71 |
-
# #cls_model.load_state_dict(torch.load(PATH))
|
72 |
-
# return tokenizer, cls_model
|
73 |
-
|
74 |
|
75 |
class myDataset_for_infer(torch.utils.data.Dataset):
|
76 |
def __init__(self, X):
|
@@ -254,17 +222,13 @@ def all_process(origin_essay):
|
|
254 |
import gradio as gr
|
255 |
outputs = [gr.Dataframe(row_count = (6, "dynamic"),
|
256 |
col_count=(2, "dynamic"),
|
257 |
-
label="Essay Summary based on Words")
|
|
|
|
|
258 |
#headers=['type','word','์ฌํ', '๋ถ๋
ธ', '๊ธฐ์จ', '๋ถ์', '์์ฒ', '๋นํฉ', 'total'])
|
259 |
|
260 |
]
|
261 |
-
|
262 |
-
|
263 |
-
#row_count = (10, "dynamic"),
|
264 |
-
#col_count=(9, "dynamic"),
|
265 |
-
#label="Results",
|
266 |
-
#headers=['type','word','์ฌํ', '๋ถ๋
ธ', '๊ธฐ์จ', '๋ถ์', '์์ฒ', '๋นํฉ', 'total'])
|
267 |
-
#]
|
268 |
|
269 |
iface = gr.Interface(
|
270 |
fn=all_process,
|
|
|
39 |
idx2emo = {v : k[1] for k, v in emo2idx.items()}
|
40 |
return emo2idx, idx2emo
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
class myDataset_for_infer(torch.utils.data.Dataset):
|
44 |
def __init__(self, X):
|
|
|
222 |
import gradio as gr
|
223 |
outputs = [gr.Dataframe(row_count = (6, "dynamic"),
|
224 |
col_count=(2, "dynamic"),
|
225 |
+
label="Essay Summary based on Words"),
|
226 |
+
title = 'MooGeulMooGeul'
|
227 |
+
|
228 |
#headers=['type','word','์ฌํ', '๋ถ๋
ธ', '๊ธฐ์จ', '๋ถ์', '์์ฒ', '๋นํฉ', 'total'])
|
229 |
|
230 |
]
|
231 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
232 |
|
233 |
iface = gr.Interface(
|
234 |
fn=all_process,
|