Views
No views yet
bert-base-uncased1{
2 "id2label": {
3 "0": "Modern",
4 "1": "Scandinavian",
5 "2": "Rustic",
6 "3": "Industrial",
7 "4": "Traditional",
8 "5": "Mid-Century Modern",
9 "6": "Coastal"
10 },
11 "label2id": {
12 "Modern": 0,
13 "Scandinavian": 1,
14 "Rustic": 2,
15 "Industrial": 3,
16 "Traditional": 4,
17 "Mid-Century Modern": 5,
18 "Coastal": 6
19 }
20}1from transformers import BertTokenizer, BertForSequenceClassification
2import torch
3
4# Load model from Hugging Face Hub
5tokenizer = BertTokenizer.from_pretrained("aimhkimi74/Bert-Model-living-room")
6model = BertForSequenceClassification.from_pretrained("aimhkimi74/Bert-Model-living-room")
7
8# Example prompt
9text = "A modern living room with a gray sofa and wooden floor."
10inputs = tokenizer(text, return_tensors="pt")
11outputs = model(**inputs)
12pred = torch.argmax(outputs.logits, dim=1)
13
14# Map prediction to style
15label_map = {
16 0: "Modern",
17 1: "Scandinavian",
18 2: "Rustic",
19 3: "Industrial",
20 4: "Traditional",
21 5: "Mid-Century Modern",
22 6: "Coastal"
23}
24print("Predicted Style:", label_map[pred.item()])