app.py
Browse files
app.py
CHANGED
@@ -5,12 +5,13 @@ from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
|
5 |
model_name = "AI" # Replace with the name or path of the model you want to use
|
6 |
tokenizer = AutoTokenizer.from_pretrained("AI")
|
7 |
model = AutoModelForSequenceClassification.from_pretrained("AI")
|
|
|
8 |
# Values for the new scenario
|
9 |
new_students = int(input("Enter the number of students in the new scenario: "))
|
10 |
new_temperature = int(input("Enter the temperature in the new scenario: "))
|
11 |
|
12 |
# Convert the input to tokens
|
13 |
-
inputs = tokenizer.
|
14 |
"Number of students: {}, Temperature: {}".format(new_students, new_temperature),
|
15 |
padding="max_length",
|
16 |
truncation=True,
|
@@ -20,7 +21,7 @@ inputs = tokenizer.encode(
|
|
20 |
|
21 |
# Make the prediction
|
22 |
with torch.no_grad():
|
23 |
-
outputs = model(inputs)
|
24 |
logits = outputs.logits
|
25 |
predicted_rooms = torch.argmax(logits, dim=1).item()
|
26 |
|
|
|
5 |
model_name = "AI" # Replace with the name or path of the model you want to use
|
6 |
tokenizer = AutoTokenizer.from_pretrained("AI")
|
7 |
model = AutoModelForSequenceClassification.from_pretrained("AI")
|
8 |
+
|
9 |
# Values for the new scenario
|
10 |
new_students = int(input("Enter the number of students in the new scenario: "))
|
11 |
new_temperature = int(input("Enter the temperature in the new scenario: "))
|
12 |
|
13 |
# Convert the input to tokens
|
14 |
+
inputs = tokenizer.encode_plus(
|
15 |
"Number of students: {}, Temperature: {}".format(new_students, new_temperature),
|
16 |
padding="max_length",
|
17 |
truncation=True,
|
|
|
21 |
|
22 |
# Make the prediction
|
23 |
with torch.no_grad():
|
24 |
+
outputs = model(**inputs)
|
25 |
logits = outputs.logits
|
26 |
predicted_rooms = torch.argmax(logits, dim=1).item()
|
27 |
|