Spaces:
Sleeping
Sleeping
File size: 622 Bytes
2856072 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
import torch
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import pandas as pd
class AIEngine:
def __init__(self):
self.model = AutoModelForSequenceClassification.from_pretrained("bert-base-uncased")
self.tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased")
def predict_health(self, df):
# Example prediction logic (using simple logic for now)
df['HealthScore'] = df['Solar Gen (kWh)'].apply(lambda x: 1.0 if x > 5 else 0.5)
df['ML_Anomaly'] = df['HealthScore'].apply(lambda x: 'Normal' if x > 0.7 else 'Risk')
return df
|