enzostvs HF staff commited on
Commit
c8dbfbe
·
1 Parent(s): dc76e4f

flat is not a function fixed

Browse files
src/lib/components/text-analysis/Preview.svelte CHANGED
@@ -2,12 +2,21 @@
2
  export let body: Record<string, any>;
3
  export let res: Record<string, any>;
4
 
5
- console.log(body, res)
 
 
6
 
7
- </script>
8
-
9
- <div class="text-white p-6 font-code text-xs !leading-loose">
10
- {#if res?.[0]?.translation_text}
11
- {res[0]?.translation_text}
12
- {/if}
 
 
 
 
 
 
 
13
  </div>
 
2
  export let body: Record<string, any>;
3
  export let res: Record<string, any>;
4
 
5
+
6
+ $: progressions = (res ?? [[]])?.flat()
7
+ </script>
8
 
9
+ <div class="text-white p-6 font-code text-xs !leading-loose grid grid-cols-1 gap-3 w-full max-w-lg">
10
+ "{body?.inputs}"
11
+ {#each progressions as { label, score }}
12
+ <div>
13
+ <div class="flex items-center justify-between mb-1">
14
+ <p class="text-blue-500">{label}</p>
15
+ <p class="text-green-500 text-xs">{score}</p>
16
+ </div>
17
+ <div class="w-full rounded-full bg-slate-800 h-[8px]">
18
+ <div class="h-full rounded-full bg-gradient-to-r from-blue-500 to-green-500" style="width: {score * 100}%"></div>
19
+ </div>
20
+ </div>
21
+ {/each}
22
  </div>
src/lib/components/text-analysis/Response.svelte CHANGED
@@ -1,12 +1,12 @@
1
  <script lang="ts">
2
  import Icon from '@iconify/svelte';
3
- import Highlight, { LineNumbers } from "svelte-highlight";
4
  import json from "svelte-highlight/languages/json";
5
  import "svelte-highlight/styles/night-owl.css"
6
 
7
  import Loading from "$lib/components/Loading.svelte"
8
  import CodePreview from '$lib/components/CodePreview.svelte';
9
- import Preview from '$lib/components/text-generation/Preview.svelte';
10
 
11
  export let loading: boolean;
12
  export let res: any;
 
1
  <script lang="ts">
2
  import Icon from '@iconify/svelte';
3
+ import Highlight from "svelte-highlight";
4
  import json from "svelte-highlight/languages/json";
5
  import "svelte-highlight/styles/night-owl.css"
6
 
7
  import Loading from "$lib/components/Loading.svelte"
8
  import CodePreview from '$lib/components/CodePreview.svelte';
9
+ import Preview from '$lib/components/text-analysis/Preview.svelte';
10
 
11
  export let loading: boolean;
12
  export let res: any;
src/lib/components/text-generation/Preview.svelte CHANGED
@@ -1,22 +1,10 @@
1
  <script lang="ts">
2
  export let body: Record<string, any>;
3
  export let res: Record<string, any>;
 
4
 
5
-
6
- $: progressions = (res ?? [[]])?.flat()
7
- </script>
8
-
9
- <div class="text-white p-6 font-code text-xs !leading-loose grid grid-cols-1 gap-3 w-full max-w-lg">
10
- "{body?.inputs}"
11
- {#each progressions as { label, score }}
12
- <div>
13
- <div class="flex items-center justify-between mb-1">
14
- <p class="text-blue-500">{label}</p>
15
- <p class="text-green-500 text-xs">{score}</p>
16
- </div>
17
- <div class="w-full rounded-full bg-slate-800 h-[8px]">
18
- <div class="h-full rounded-full bg-gradient-to-r from-blue-500 to-green-500" style="width: {score * 100}%"></div>
19
- </div>
20
- </div>
21
- {/each}
22
  </div>
 
1
  <script lang="ts">
2
  export let body: Record<string, any>;
3
  export let res: Record<string, any>;
4
+ </script>
5
 
6
+ <div class="text-white p-6 font-code text-xs !leading-loose">
7
+ {#if res?.[0]?.translation_text}
8
+ {res[0]?.translation_text}
9
+ {/if}
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  </div>