darabos commited on
Commit
e2d0e27
·
1 Parent(s): bdf2455

Make tables update correctly.

Browse files
requirements.txt CHANGED
@@ -5,3 +5,5 @@ numpy
5
  pandas
6
  scipy
7
  uvicorn[standard]
 
 
 
5
  pandas
6
  scipy
7
  uvicorn[standard]
8
+ # For llm_ops
9
+ openai
server/llm_ops.py CHANGED
@@ -28,7 +28,7 @@ def create_prompt(input, *, template: str):
28
  for c in df.columns:
29
  p = p.replace(c.upper(), str(row[c]))
30
  prompts.append(p)
31
- df['prompt'] = p
32
  return df
33
 
34
 
@@ -47,7 +47,7 @@ def ask_llm(input, *, model: str, choices: list = None, max_tokens: int = 100):
47
  model=model,
48
  max_tokens=max_tokens,
49
  messages=[
50
- {"role": "user", "content": row['text']},
51
  ],
52
  **g,
53
  )
 
28
  for c in df.columns:
29
  p = p.replace(c.upper(), str(row[c]))
30
  prompts.append(p)
31
+ df['prompt'] = prompts
32
  return df
33
 
34
 
 
47
  model=model,
48
  max_tokens=max_tokens,
49
  messages=[
50
+ {"role": "user", "content": row['prompt']},
51
  ],
52
  **g,
53
  )
web/package-lock.json CHANGED
The diff for this file is too large to render. See raw diff
 
web/src/Table.svelte CHANGED
@@ -7,10 +7,10 @@
7
  let tableComponent;
8
  let tab;
9
 
10
- onMount(() => {
11
- console.log(data, columns);
12
- // The rows in the data are arrays, but Tabulator expects objects.
13
- const objs = [];
14
  for (const row of data) {
15
  const obj = {};
16
  for (let i = 0; i < columns.length; i++) {
@@ -18,6 +18,9 @@
18
  }
19
  objs.push(obj);
20
  }
 
 
 
21
  tab = new Tabulator(tableComponent, {
22
  data: objs,
23
  columns: columns.map(c => ({title: c, field: c, widthGrow: 1})),
 
7
  let tableComponent;
8
  let tab;
9
 
10
+ // The rows in the data are arrays, but Tabulator expects objects.
11
+ const objs = [];
12
+ $: {
13
+ objs.splice();
14
  for (const row of data) {
15
  const obj = {};
16
  for (let i = 0; i < columns.length; i++) {
 
18
  }
19
  objs.push(obj);
20
  }
21
+ }
22
+
23
+ onMount(() => {
24
  tab = new Tabulator(tableComponent, {
25
  data: objs,
26
  columns: columns.map(c => ({title: c, field: c, widthGrow: 1})),