Spaces:
Runtime error
Runtime error
add instructions
Browse files- frontend/src/lib/Result.svelte +2 -1
- frontend/src/routes/index.svelte +39 -7
- frontend/static/img1.jpg +0 -0
- frontend/static/img2.jpg +0 -0
frontend/src/lib/Result.svelte
CHANGED
@@ -4,6 +4,7 @@
|
|
4 |
import { fade, scale } from 'svelte/transition';
|
5 |
import { createEventDispatcher, onDestroy, onMount } from 'svelte';
|
6 |
import type { SvelteComponent } from 'svelte';
|
|
|
7 |
|
8 |
const dispatch = createEventDispatcher();
|
9 |
|
@@ -13,7 +14,7 @@
|
|
13 |
export let totalStreaks: number;
|
14 |
const message = cheersMessages[currentRowIndex];
|
15 |
import domtoimage from 'dom-to-image';
|
16 |
-
const apiUrl =
|
17 |
|
18 |
let modalEl: HTMLDivElement;
|
19 |
let elToShare: HTMLDivElement;
|
|
|
4 |
import { fade, scale } from 'svelte/transition';
|
5 |
import { createEventDispatcher, onDestroy, onMount } from 'svelte';
|
6 |
import type { SvelteComponent } from 'svelte';
|
7 |
+
import { dev } from '$app/env';
|
8 |
|
9 |
const dispatch = createEventDispatcher();
|
10 |
|
|
|
14 |
export let totalStreaks: number;
|
15 |
const message = cheersMessages[currentRowIndex];
|
16 |
import domtoimage from 'dom-to-image';
|
17 |
+
const apiUrl = dev ? 'http://localhost:7860/' : '';
|
18 |
|
19 |
let modalEl: HTMLDivElement;
|
20 |
let elToShare: HTMLDivElement;
|
frontend/src/routes/index.svelte
CHANGED
@@ -9,10 +9,11 @@
|
|
9 |
import Message from '$lib/Message.svelte';
|
10 |
|
11 |
import { onMount, onDestroy } from 'svelte';
|
12 |
-
import { browser } from '$app/env';
|
|
|
13 |
|
14 |
const totalTime = 1000;
|
15 |
-
const apiUrl =
|
16 |
let allowShare = true;
|
17 |
let promptsData: PromptsData;
|
18 |
let completedPrompts: SuccessPrompt[] = [];
|
@@ -72,11 +73,11 @@
|
|
72 |
const randomPrompt: string = promptsFiltered[radomPromptId];
|
73 |
currPromptIndex = prompts.indexOf(randomPrompt);
|
74 |
|
75 |
-
answer = randomPrompt.replace(/_/g, ' ');
|
76 |
imagePaths = promptsData[randomPrompt].slice(0, 6);
|
77 |
const clue = [...answer].map((a) => (Math.random() > 0.5 ? '*' : a)).join('');
|
78 |
console.log('%cCLUE: ', 'color: red;font-weight:bold', clue);
|
79 |
-
cols =
|
80 |
timePerTile = totalTime / cols;
|
81 |
|
82 |
board = Array.from({ length: 7 }, () =>
|
@@ -280,9 +281,40 @@
|
|
280 |
{/each}
|
281 |
</div>
|
282 |
<Keyboard on:keyup={({ detail }) => onKey(detail)} bind:letterStates />
|
283 |
-
<footer class="max-w-md mx-auto
|
284 |
-
<details class="text-xs
|
285 |
-
<summary class="my-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
286 |
<span>Disclaimer</span>
|
287 |
</summary>
|
288 |
<p>
|
|
|
9 |
import Message from '$lib/Message.svelte';
|
10 |
|
11 |
import { onMount, onDestroy } from 'svelte';
|
12 |
+
import { browser, dev } from '$app/env';
|
13 |
+
import { base } from '$app/paths';
|
14 |
|
15 |
const totalTime = 1000;
|
16 |
+
const apiUrl = dev ? 'http://localhost:7860/' : '';
|
17 |
let allowShare = true;
|
18 |
let promptsData: PromptsData;
|
19 |
let completedPrompts: SuccessPrompt[] = [];
|
|
|
73 |
const randomPrompt: string = promptsFiltered[radomPromptId];
|
74 |
currPromptIndex = prompts.indexOf(randomPrompt);
|
75 |
|
76 |
+
answer = 'cat eating noodle'; //randomPrompt.replace(/_/g, ' ');
|
77 |
imagePaths = promptsData[randomPrompt].slice(0, 6);
|
78 |
const clue = [...answer].map((a) => (Math.random() > 0.5 ? '*' : a)).join('');
|
79 |
console.log('%cCLUE: ', 'color: red;font-weight:bold', clue);
|
80 |
+
cols = answer.length;
|
81 |
timePerTile = totalTime / cols;
|
82 |
|
83 |
board = Array.from({ length: 7 }, () =>
|
|
|
281 |
{/each}
|
282 |
</div>
|
283 |
<Keyboard on:keyup={({ detail }) => onKey(detail)} bind:letterStates />
|
284 |
+
<footer class="max-w-md mx-auto pt-3">
|
285 |
+
<details class="text-xs my-3">
|
286 |
+
<summary class="cursor-pointer my-2">
|
287 |
+
<span>About</span>
|
288 |
+
</summary>
|
289 |
+
<p>
|
290 |
+
Welcome to Wordalle! The game that marries <a
|
291 |
+
href="https://huggingface.co/spaces/dalle-mini/dalle-mini"
|
292 |
+
target="_blank"
|
293 |
+
rel="noopener noreferrer"
|
294 |
+
class="underline hover:text-blue-500 hover:no-underline"
|
295 |
+
>
|
296 |
+
DALLE mini</a
|
297 |
+
> & Wordle!β
|
298 |
+
</p>
|
299 |
+
<h2 class="font-bold my-2">Instructions</h2>
|
300 |
+
<p>
|
301 |
+
You are given a board with a grid of letters. You must guess the prompt used to generate
|
302 |
+
the images.
|
303 |
+
</p>
|
304 |
+
<p>
|
305 |
+
Your guess must contain the same number of letters as tiles. After you guess, the tiles
|
306 |
+
will be revealed.
|
307 |
+
</p>
|
308 |
+
<h2 class="font-bold my-2">Example</h2>
|
309 |
+
<p class="pb-3">
|
310 |
+
The green tiles are correct letter placements. The yellow tiles are correct letters but in
|
311 |
+
wrong position and the gray tiles are letters not present in the prompt.
|
312 |
+
<img alt="wordalle example for dog eating pastas" src={base + '/img1.jpg'} />
|
313 |
+
<img alt="wordalle example for cat eating noodle " src={base + '/img2.jpg'} />
|
314 |
+
</p>
|
315 |
+
</details>
|
316 |
+
<details class="text-xs my-3">
|
317 |
+
<summary class="cursor-pointer my-2">
|
318 |
<span>Disclaimer</span>
|
319 |
</summary>
|
320 |
<p>
|
frontend/static/img1.jpg
ADDED
frontend/static/img2.jpg
ADDED