Spaces:
Configuration error
Configuration error
Update app.py
Browse files
app.py
CHANGED
@@ -8,27 +8,22 @@ from torch.nn.functional import softmax
|
|
8 |
|
9 |
app = Flask(__name__)
|
10 |
|
11 |
-
#
|
12 |
mongo_client = pymongo.MongoClient('mongodb://localhost:27017/')
|
13 |
db = mongo_client['EgitimDatabase']
|
14 |
collection = db['test']
|
15 |
|
16 |
-
# Model ve tokenizer'ı yükleme
|
17 |
-
model_name = "alan-turing-institute/mt5-large-finetuned-mnli-xtreme-xnli"
|
18 |
-
tokenizer = MT5Tokenizer.from_pretrained(model_name)
|
19 |
-
model = MT5ForConditionalGeneration.from_pretrained(model_name)
|
20 |
-
model.eval()
|
21 |
|
22 |
-
def process_nli(premise: str, hypothesis: str):
|
23 |
-
"""NLI formatına uygun hale getirir"""
|
24 |
-
return "".join(['xnli: premise: ', premise, ' hypothesis: ', hypothesis])
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
30 |
|
31 |
-
|
|
|
|
|
32 |
outputs = model.generate(**inputs, output_scores=True, return_dict_in_generate=True, num_beams=5)
|
33 |
generated_text = tokenizer.decode(outputs.sequences[0], skip_special_tokens=True)
|
34 |
|
|
|
8 |
|
9 |
app = Flask(__name__)
|
10 |
|
11 |
+
#hazırladığım verilere ait database
|
12 |
mongo_client = pymongo.MongoClient('mongodb://localhost:27017/')
|
13 |
db = mongo_client['EgitimDatabase']
|
14 |
collection = db['test']
|
15 |
|
|
|
|
|
|
|
|
|
|
|
16 |
|
|
|
|
|
|
|
17 |
|
18 |
+
#kullanıcılara ait inputların kaydedileceği database
|
19 |
+
mongo_client = pymongo.MongoClient('mongodb://localhost:27017/')
|
20 |
+
db = mongo_client['EgitimDatabase']
|
21 |
+
collection = db['input']
|
22 |
+
|
23 |
|
24 |
+
|
25 |
+
|
26 |
+
|
27 |
outputs = model.generate(**inputs, output_scores=True, return_dict_in_generate=True, num_beams=5)
|
28 |
generated_text = tokenizer.decode(outputs.sequences[0], skip_special_tokens=True)
|
29 |
|