damiano216 commited on
Commit
4692dc0
·
verified ·
1 Parent(s): 180cc65

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +8 -1
handler.py CHANGED
@@ -1,6 +1,7 @@
1
  import torch
2
  import torch.nn as nn
3
  from huggingface_hub import PyTorchModelHubMixin
 
4
 
5
  # Set device
6
  device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
@@ -25,7 +26,13 @@ class EndpointHandler:
25
  def __call__(self, data):
26
 
27
  print(f"Payload: {data}")
28
- new_data_tensor = torch.tensor(data['chargeData'], dtype=torch.float32).to(device) # Ensure tensor is on device
 
 
 
 
 
 
29
 
30
  # Make predictions
31
  with torch.no_grad():
 
1
  import torch
2
  import torch.nn as nn
3
  from huggingface_hub import PyTorchModelHubMixin
4
+ import pandas as pd
5
 
6
  # Set device
7
  device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
 
26
  def __call__(self, data):
27
 
28
  print(f"Payload: {data}")
29
+
30
+ # Create a Pandas DataFrame
31
+ payloadDataFrame = pd.DataFrame(data['chargeData'])
32
+ print(payloadDataFrame)
33
+
34
+
35
+ new_data_tensor = torch.tensor(payloadDataFrame.values, dtype=torch.float).to(device) # Ensure tensor is on device
36
 
37
  # Make predictions
38
  with torch.no_grad():