mike dupont commited on
Commit
18d5404
·
1 Parent(s): 198515a

trying to package up

Browse files
.gitignore CHANGED
@@ -21,3 +21,5 @@
21
  npm-debug.log*
22
  yarn-debug.log*
23
  yarn-error.log*
 
 
 
21
  npm-debug.log*
22
  yarn-debug.log*
23
  yarn-error.log*
24
+ /frontend/build/
25
+ /frontend/node_modules/
frontend/index.html DELETED
@@ -1,29 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
-
4
- <head>
5
- <meta charset="UTF-8" />
6
- <link rel="stylesheet" href="style.css" />
7
-
8
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
9
- <title>Transformers.js - Object Detection</title>
10
- </head>
11
-
12
- <body>
13
- <h1>Object Detection w/ 🤗 Transformers.js</h1>
14
- <label id="container" for="upload">
15
- <svg width="25" height="25" viewBox="0 0 25 25" fill="none" xmlns="http://www.w3.org/2000/svg">
16
- <path fill="#000"
17
- d="M3.5 24.3a3 3 0 0 1-1.9-.8c-.5-.5-.8-1.2-.8-1.9V2.9c0-.7.3-1.3.8-1.9.6-.5 1.2-.7 2-.7h18.6c.7 0 1.3.2 1.9.7.5.6.7 1.2.7 2v18.6c0 .7-.2 1.4-.7 1.9a3 3 0 0 1-2 .8H3.6Zm0-2.7h18.7V2.9H3.5v18.7Zm2.7-2.7h13.3c.3 0 .5 0 .6-.3v-.7l-3.7-5a.6.6 0 0 0-.6-.2c-.2 0-.4 0-.5.3l-3.5 4.6-2.4-3.3a.6.6 0 0 0-.6-.3c-.2 0-.4.1-.5.3l-2.7 3.6c-.1.2-.2.4 0 .7.1.2.3.3.6.3Z">
18
- </path>
19
- </svg>
20
- Click to upload image
21
- <label id="example">(or try example)</label>
22
- </label>
23
- <label id="status">Loading model...</label>
24
- <input id="upload" type="file" accept="image/*" />
25
-
26
- <script src="index.js" type="module"></script>
27
- </body>
28
-
29
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend/index.js DELETED
@@ -1,79 +0,0 @@
1
- import { pipeline, env } from 'https://cdn.jsdelivr.net/npm/@xenova/transformers@2.10.1';
2
-
3
- // Since we will download the model from the Hugging Face Hub, we can skip the local model check
4
- env.allowLocalModels = false;
5
-
6
- // Reference the elements that we will need
7
- const status = document.getElementById('status');
8
- const fileUpload = document.getElementById('upload');
9
- const imageContainer = document.getElementById('container');
10
- const example = document.getElementById('example');
11
-
12
- const EXAMPLE_URL = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/city-streets.jpg';
13
-
14
- // Create a new object detection pipeline
15
- status.textContent = 'Loading model...';
16
- const detector = await pipeline('object-detection', 'Xenova/detr-resnet-50');
17
- status.textContent = 'Ready';
18
-
19
- example.addEventListener('click', (e) => {
20
- e.preventDefault();
21
- detect(EXAMPLE_URL);
22
- });
23
-
24
- fileUpload.addEventListener('change', function (e) {
25
- const file = e.target.files[0];
26
- if (!file) {
27
- return;
28
- }
29
-
30
- const reader = new FileReader();
31
-
32
- // Set up a callback when the file is loaded
33
- reader.onload = e2 => detect(e2.target.result);
34
-
35
- reader.readAsDataURL(file);
36
- });
37
-
38
-
39
- // Detect objects in the image
40
- async function detect(img) {
41
- imageContainer.innerHTML = '';
42
- imageContainer.style.backgroundImage = `url(${img})`;
43
-
44
- status.textContent = 'Analysing...';
45
- const output = await detector(img, {
46
- threshold: 0.5,
47
- percentage: true,
48
- });
49
- status.textContent = '';
50
- output.forEach(renderBox);
51
- }
52
-
53
- // Render a bounding box and label on the image
54
- function renderBox({ box, label }) {
55
- const { xmax, xmin, ymax, ymin } = box;
56
-
57
- // Generate a random color for the box
58
- const color = '#' + Math.floor(Math.random() * 0xFFFFFF).toString(16).padStart(6, 0);
59
-
60
- // Draw the box
61
- const boxElement = document.createElement('div');
62
- boxElement.className = 'bounding-box';
63
- Object.assign(boxElement.style, {
64
- borderColor: color,
65
- left: 100 * xmin + '%',
66
- top: 100 * ymin + '%',
67
- width: 100 * (xmax - xmin) + '%',
68
- height: 100 * (ymax - ymin) + '%',
69
- })
70
-
71
- // Draw label
72
- const labelElement = document.createElement('span');
73
- labelElement.textContent = label;
74
- labelElement.className = 'bounding-box-label';
75
- labelElement.style.backgroundColor = color;
76
-
77
- boxElement.appendChild(labelElement);
78
- imageContainer.appendChild(boxElement);
79
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend/package-lock.json CHANGED
The diff for this file is too large to render. See raw diff
 
frontend/package.json CHANGED
@@ -3,19 +3,20 @@
3
  "version": "0.1.0",
4
  "private": true,
5
  "dependencies": {
 
6
  "@testing-library/jest-dom": "^5.17.0",
7
  "@testing-library/react": "^13.4.0",
8
  "@testing-library/user-event": "^13.5.0",
9
  "react": "^18.3.1",
10
  "react-dom": "^18.3.1",
11
- "react-scripts": "5.0.1",
12
  "web-vitals": "^2.1.4"
13
  },
14
  "scripts": {
15
- "start": "react-scripts start",
16
- "build": "react-scripts build",
17
- "test": "react-scripts test",
18
- "eject": "react-scripts eject"
19
  },
20
  "eslintConfig": {
21
  "extends": [
 
3
  "version": "0.1.0",
4
  "private": true,
5
  "dependencies": {
6
+ "@nextui-org/react": "^2.4.8",
7
  "@testing-library/jest-dom": "^5.17.0",
8
  "@testing-library/react": "^13.4.0",
9
  "@testing-library/user-event": "^13.5.0",
10
  "react": "^18.3.1",
11
  "react-dom": "^18.3.1",
12
+ "react-scripts": "^5.0.1",
13
  "web-vitals": "^2.1.4"
14
  },
15
  "scripts": {
16
+ "start": "react-scripts --openssl-legacy-provider start ",
17
+ "build": "react-scripts --openssl-legacy-provider build",
18
+ "test": "react-scripts --openssl-legacy-provider test",
19
+ "eject": "react-scripts --openssl-legacy-provider eject"
20
  },
21
  "eslintConfig": {
22
  "extends": [
frontend/src/App.js CHANGED
@@ -1,5 +1,13 @@
1
  import logo from './logo.svg';
2
  import './App.css';
 
 
 
 
 
 
 
 
3
 
4
  function App() {
5
  return (
@@ -7,7 +15,41 @@ function App() {
7
  <header className="App-header">
8
  <img src={logo} className="App-logo" alt="logo" />
9
  <p>
10
- Hello World
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  </p>
12
  <a
13
  className="App-link"
 
1
  import logo from './logo.svg';
2
  import './App.css';
3
+ import {
4
+ Table,
5
+ TableHeader,
6
+ TableBody,
7
+ TableColumn,
8
+ TableRow,
9
+ TableCell
10
+ } from "@nextui-org/table";
11
 
12
  function App() {
13
  return (
 
15
  <header className="App-header">
16
  <img src={logo} className="App-logo" alt="logo" />
17
  <p>
18
+ Experiments
19
+ <Table
20
+ aria-label="Experiments"
21
+ >
22
+ <TableHeader>
23
+ <TableColumn>ID</TableColumn>
24
+ <TableColumn>Link</TableColumn>
25
+ </TableHeader>
26
+ <TableBody>
27
+ <TableRow key="hf">
28
+ <TableCell><pre><code>Hugging Face</code></pre></TableCell>
29
+ <TableCell><a href="https://huggingface.co/introspector">Hugging Face</a></TableCell>
30
+ </TableRow>
31
+
32
+ <TableRow key="gh">
33
+ <TableCell>
34
+ <pre><code>Github Repositories</code></pre></TableCell>
35
+ <TableCell><a href="https://github.com/meta-introspector">Github</a></TableCell>
36
+ </TableRow>
37
+
38
+ <TableRow key="bp">
39
+ <TableCell>
40
+ <pre><code>Blog posts</code></pre></TableCell>
41
+ <TableCell><a href="https://h4ck3rm1k3.wordpress.com">Wordpress</a></TableCell>
42
+ </TableRow>
43
+
44
+ <TableRow key="tweets">
45
+ <TableCell>
46
+ <pre><code>Tweets</code></pre></TableCell>
47
+ <TableCell><a href="https://x.com/introsp3ctor">Twitter</a></TableCell>
48
+ </TableRow>
49
+
50
+
51
+ </TableBody>
52
+ </Table>
53
  </p>
54
  <a
55
  className="App-link"
report.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # simple report
2
+ # 1. list the datasets in my hugging face org
3
+ # filter by some criteria
4
+ # add to git submodules
5
+ # 2. list the files in my git submodules
6
+ # filter by some citeria
7
+ # for each file calculate an absolute path to find the data
8
+ # construct a rdf linked data file for each dataset, call it introspector.rdf.js put into each repository.
9
+ # we can use json-ld
10
+ # 3. populate a directory structure in json file
11
+ # load json into js,
12
+ # use a d3 js spring graph and interactive query system
13
+ # display json on screen
14
+ # and when item is selected select the iframe to display the url referenced.