AEUPH commited on
Commit
13115c0
·
verified ·
1 Parent(s): 12acde2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -19
app.py CHANGED
@@ -8,32 +8,22 @@ import uuid
8
  # Global initialization
9
  tokenizer = GPT2Tokenizer.from_pretrained('gpt2')
10
  model = GPT2LMHeadModel.from_pretrained('gpt2')
 
11
 
12
  class SecondLifeNavigator:
13
- def __init__(self, dataset_path, corrade_api_key='nucleus'):
14
- self.dataset = self.load_dataset(dataset_path)
15
- self.corrade_api_key = corrade_api_key
16
-
17
- def load_dataset(self, dataset_path):
18
- data = []
19
- with open(dataset_path, newline='') as csvfile:
20
- reader = csv.DictReader(csvfile)
21
- for row in reader:
22
- # Assuming 'x', 'y', 'z' are columns in your CSV and you want to store them as a vector dict
23
- vector = {'x': float(row['x']), 'y': float(row['y']), 'z': float(row['z'])}
24
- entry = {
25
- "id": row['id'],
26
- "vector": vector,
27
- "action": row['action']
28
- }
29
- data.append(entry)
30
- return data
31
 
32
  def send_command_to_corrade(self, corrade_endpoint, command, parameters):
33
  command_data = {
34
  "command": command,
35
  "group": "e269893f-a570-0087-930e-6ba2a0b77f9c",
36
- "password": self.corrade_api_key,
37
  }
38
  command_data.update(parameters)
39
 
 
8
  # Global initialization
9
  tokenizer = GPT2Tokenizer.from_pretrained('gpt2')
10
  model = GPT2LMHeadModel.from_pretrained('gpt2')
11
+ from datasets import load_dataset
12
 
13
  class SecondLifeNavigator:
14
+ def __init__(self):
15
+ self.dataset = self.load_dataset()
16
+
17
+ def load_dataset(self):
18
+ # Loads the dataset directly from Hugging Face
19
+ dataset = load_dataset("visionlab/block-towers-10k-3s-trajectory-scale1")
20
+ return dataset
 
 
 
 
 
 
 
 
 
 
 
21
 
22
  def send_command_to_corrade(self, corrade_endpoint, command, parameters):
23
  command_data = {
24
  "command": command,
25
  "group": "e269893f-a570-0087-930e-6ba2a0b77f9c",
26
+ "password": "nucleus",
27
  }
28
  command_data.update(parameters)
29