coyotte508 commited on
Commit
73f1392
1 Parent(s): 075be5d

🍱 Add fake dduf files

Browse files
README.md CHANGED
@@ -8,41 +8,18 @@ pinned: false
8
  port: 3000
9
  ---
10
 
11
- # sv
12
 
13
- Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli).
14
 
15
- ## Creating a project
16
-
17
- If you're seeing this, you've probably already done this step. Congrats!
18
 
19
  ```bash
20
- # create a new project in the current directory
21
- npx sv create
22
-
23
- # create a new project in my-app
24
- npx sv create my-app
25
  ```
26
 
27
- ## Developing
28
-
29
- Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
30
 
31
  ```bash
32
- npm run dev
33
-
34
- # or start the server and open the app in a new browser tab
35
- npm run dev -- --open
36
  ```
37
-
38
- ## Building
39
-
40
- To create a production version of your app:
41
-
42
- ```bash
43
- npm run build
44
- ```
45
-
46
- You can preview the production build with `npm run preview`.
47
-
48
- > To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
 
8
  port: 3000
9
  ---
10
 
11
+ # DDUF Check
12
 
13
+ This spaces analyzes a file and checks if it is a DDUF file. A DDUF file is an uncompressed ZIP that contains .json and .safetensors files, with max one level of nesting.
14
 
15
+ You can generate a simple DDUF file by running the following command:
 
 
16
 
17
  ```bash
18
+ cd dduf-content && zip -r -0 ../file.dduf .
 
 
 
 
19
  ```
20
 
21
+ You can try zip 64 format by running the following command:
 
 
22
 
23
  ```bash
24
+ cd dduf-content && zip -r -0 -fz ../file-64.dduf .
 
 
 
25
  ```
 
 
 
 
 
 
 
 
 
 
 
 
dduf-content/scheduler/scheduler-config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {}
dduf-content/text_encoder/config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {}
dduf-content/text_encoder/model-00001-of-00002.safetensors ADDED
File without changes
dduf-content/text_encoder/model-00002-of-00002.safetensors ADDED
File without changes
dduf-content/text_encoder/models.saftensors.index.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {}
dduf-content/text_encoder_2/config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {}
dduf-content/text_encoder_2/model-00001-of-00002.safetensors ADDED
File without changes
dduf-content/text_encoder_2/model-00002-of-00002.safetensors ADDED
File without changes
dduf-content/text_encoder_2/models.saftensors.index.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {}
dduf-content/tokenizer/merges.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ blablabla
dduf-content/tokenizer/special_tokens_map.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {}
dduf-content/tokenizer/tokenizer_config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {}
dduf-content/tokenizer/vocab.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {}
dduf-content/tokenizer_2/special_tokens_map.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {}
dduf-content/tokenizer_2/spiece.model ADDED
File without changes
dduf-content/tokenizer_2/tokenizer_config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {}
dduf-content/tokenizer_2/vocab.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {}
dduf-content/transformer/config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {}
dduf-content/transformer/diffusion_pytorch_model.safetensors ADDED
File without changes
dduf-content/vae/config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {}
dduf-content/vae/diffusion_pytorch_model.safetensors ADDED
File without changes
file-64.dduf ADDED
Binary file (6.16 kB). View file
 
file.dduf ADDED
Binary file (5.19 kB). View file
 
src/lib/check-dduf.ts CHANGED
@@ -1,3 +1,15 @@
1
- export async function checkDduf(url: string): Promise<string> {
2
 
3
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { WebBlob } from './WebBlob';
2
 
3
+ export async function* checkDduf(url: string): AsyncGenerator<string> {
4
+ const blob = await WebBlob.create(new URL(url));
5
+
6
+ yield 'File size: ' + blob.size;
7
+
8
+ // DDUF is a zip file, uncompressed.
9
+
10
+ const last100kb = await blob.slice(blob.size - 100000, blob.size).arrayBuffer();
11
+
12
+ const view = new DataView(last100kb);
13
+
14
+ let index = view.byteLength - 22;
15
+ }
src/routes/+page.svelte CHANGED
@@ -7,8 +7,11 @@
7
 
8
  async function handleSubmit(event: Event) {
9
  event.preventDefault();
 
10
 
11
- output = await checkDduf(url);
 
 
12
  }
13
  </script>
14
 
 
7
 
8
  async function handleSubmit(event: Event) {
9
  event.preventDefault();
10
+ output = 'Checking...';
11
 
12
+ for await (const str of checkDduf(url)) {
13
+ output += '\n' + str;
14
+ }
15
  }
16
  </script>
17