Update app.py
Browse files
app.py
CHANGED
@@ -26,6 +26,26 @@ app = Flask(__name__, template_folder='templates')
|
|
26 |
CORS(app)
|
27 |
chat_history = []
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
model_name = "deepset/tinyroberta-squad2"
|
30 |
nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
|
31 |
|
@@ -256,23 +276,6 @@ def home():
|
|
256 |
print("Form Data:", request.form)
|
257 |
input_submitted = True
|
258 |
print(url_input)
|
259 |
-
cls_model = AutoModelForSequenceClassification.from_pretrained("riskclassification_finetuned_xlnet_model_ld")
|
260 |
-
tokenizer_cls = AutoTokenizer.from_pretrained("xlnet-base-cased")
|
261 |
-
label_encoder_path = "riskclassification_finetuned_xlnet_model_ld/encoder_labels.pkl"
|
262 |
-
label_encoder = LabelEncoder()
|
263 |
-
|
264 |
-
# Assuming 'label_column values' is the column you want to encode
|
265 |
-
label_column_values = ["risks","opportunities","neither"]
|
266 |
-
|
267 |
-
|
268 |
-
label_encoder.fit_transform(label_column_values)
|
269 |
-
|
270 |
-
joblib.dump(label_encoder, label_encoder_path)
|
271 |
-
|
272 |
-
|
273 |
-
model_summ = T5ForConditionalGeneration.from_pretrained("t5-small")
|
274 |
-
tokenizer_summ = T5Tokenizer.from_pretrained("t5-small")
|
275 |
-
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
276 |
|
277 |
if url_input.startswith("http"):
|
278 |
current_request_timestamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
|
|
26 |
CORS(app)
|
27 |
chat_history = []
|
28 |
|
29 |
+
|
30 |
+
cls_model = AutoModelForSequenceClassification.from_pretrained("riskclassification_finetuned_xlnet_model_ld")
|
31 |
+
tokenizer_cls = AutoTokenizer.from_pretrained("xlnet-base-cased")
|
32 |
+
label_encoder_path = "riskclassification_finetuned_xlnet_model_ld/encoder_labels.pkl"
|
33 |
+
label_encoder = LabelEncoder()
|
34 |
+
|
35 |
+
# Assuming 'label_column values' is the column you want to encode
|
36 |
+
label_column_values = ["risks","opportunities","neither"]
|
37 |
+
|
38 |
+
|
39 |
+
label_encoder.fit_transform(label_column_values)
|
40 |
+
|
41 |
+
joblib.dump(label_encoder, label_encoder_path)
|
42 |
+
|
43 |
+
|
44 |
+
model_summ = T5ForConditionalGeneration.from_pretrained("t5-small")
|
45 |
+
tokenizer_summ = T5Tokenizer.from_pretrained("t5-small")
|
46 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
47 |
+
|
48 |
+
|
49 |
model_name = "deepset/tinyroberta-squad2"
|
50 |
nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
|
51 |
|
|
|
276 |
print("Form Data:", request.form)
|
277 |
input_submitted = True
|
278 |
print(url_input)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
279 |
|
280 |
if url_input.startswith("http"):
|
281 |
current_request_timestamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|