Spaces:
Running
Running
Add interaction
Browse files- package-lock.json +4 -4
- src/App.js +38 -7
package-lock.json
CHANGED
@@ -16786,16 +16786,16 @@
|
|
16786 |
}
|
16787 |
},
|
16788 |
"node_modules/typescript": {
|
16789 |
-
"version": "
|
16790 |
-
"resolved": "https://registry.npmjs.org/typescript/-/typescript-
|
16791 |
-
"integrity": "sha512-
|
16792 |
"peer": true,
|
16793 |
"bin": {
|
16794 |
"tsc": "bin/tsc",
|
16795 |
"tsserver": "bin/tsserver"
|
16796 |
},
|
16797 |
"engines": {
|
16798 |
-
"node": ">=
|
16799 |
}
|
16800 |
},
|
16801 |
"node_modules/unbox-primitive": {
|
|
|
16786 |
}
|
16787 |
},
|
16788 |
"node_modules/typescript": {
|
16789 |
+
"version": "4.9.5",
|
16790 |
+
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
|
16791 |
+
"integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
|
16792 |
"peer": true,
|
16793 |
"bin": {
|
16794 |
"tsc": "bin/tsc",
|
16795 |
"tsserver": "bin/tsserver"
|
16796 |
},
|
16797 |
"engines": {
|
16798 |
+
"node": ">=4.2.0"
|
16799 |
}
|
16800 |
},
|
16801 |
"node_modules/unbox-primitive": {
|
src/App.js
CHANGED
@@ -1,7 +1,9 @@
|
|
1 |
import { useState } from "react";
|
|
|
2 |
|
3 |
const projectTypes = ["model", "dataset", "space"];
|
4 |
|
|
|
5 |
/**
|
6 |
* 1. User click enter key
|
7 |
* 2. Get model/dataset/space name
|
@@ -10,9 +12,29 @@ const projectTypes = ["model", "dataset", "space"];
|
|
10 |
* 5. Draw line chart
|
11 |
*/
|
12 |
function App() {
|
13 |
-
const [projectType, setProjectType] = useState("
|
14 |
-
const [projectName, setProjectName] = useState("
|
|
|
|
|
|
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
return (
|
17 |
<div className="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8 py-16">
|
18 |
<div className="mx-auto max-w-3xl">
|
@@ -30,10 +52,11 @@ function App() {
|
|
30 |
name="country"
|
31 |
autoComplete="country"
|
32 |
className="h-full rounded-md border-0 bg-transparent py-0 pl-3 pr-7 text-gray-500 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm"
|
|
|
33 |
>
|
34 |
-
<option>Model</option>
|
35 |
-
<option>Dataset</option>
|
36 |
-
<option>Space</option>
|
37 |
</select>
|
38 |
</div>
|
39 |
<input
|
@@ -42,11 +65,19 @@ function App() {
|
|
42 |
id="phone-number"
|
43 |
className="block w-full rounded-md border-0 py-1.5 pl-24 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6"
|
44 |
placeholder="meta-llama/Llama-2-7b"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
/>
|
46 |
</div>
|
47 |
</div>
|
48 |
-
|
49 |
-
|
|
|
50 |
</div>
|
51 |
</div>
|
52 |
);
|
|
|
1 |
import { useState } from "react";
|
2 |
+
import chartXkcd from "chart.xkcd";
|
3 |
|
4 |
const projectTypes = ["model", "dataset", "space"];
|
5 |
|
6 |
+
|
7 |
/**
|
8 |
* 1. User click enter key
|
9 |
* 2. Get model/dataset/space name
|
|
|
12 |
* 5. Draw line chart
|
13 |
*/
|
14 |
function App() {
|
15 |
+
const [projectType, setProjectType] = useState("Model");
|
16 |
+
const [projectName, setProjectName] = useState("");
|
17 |
+
|
18 |
+
const onSubmit = () => {
|
19 |
+
const svg = document.querySelector('.line-chart')
|
20 |
|
21 |
+
new chartXkcd.Line(svg, {
|
22 |
+
title: 'Like hitory',
|
23 |
+
xLabel: 'Month',
|
24 |
+
yLabel: '$ Dollars',
|
25 |
+
data: {
|
26 |
+
labels: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'],
|
27 |
+
datasets: [{
|
28 |
+
label: 'Plan',
|
29 |
+
data: [30, 70, 200, 300, 500, 800, 1500, 2900, 5000, 8000],
|
30 |
+
}, {
|
31 |
+
label: 'Reality',
|
32 |
+
data: [0, 1, 30, 70, 80, 100, 50, 80, 40, 150],
|
33 |
+
}]
|
34 |
+
},
|
35 |
+
options: {}
|
36 |
+
});
|
37 |
+
}
|
38 |
return (
|
39 |
<div className="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8 py-16">
|
40 |
<div className="mx-auto max-w-3xl">
|
|
|
52 |
name="country"
|
53 |
autoComplete="country"
|
54 |
className="h-full rounded-md border-0 bg-transparent py-0 pl-3 pr-7 text-gray-500 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm"
|
55 |
+
onChange={(e) => setProjectType(e.target.value)}
|
56 |
>
|
57 |
+
<option value="model">Model</option>
|
58 |
+
<option value="dataset">Dataset</option>
|
59 |
+
<option value="space">Space</option>
|
60 |
</select>
|
61 |
</div>
|
62 |
<input
|
|
|
65 |
id="phone-number"
|
66 |
className="block w-full rounded-md border-0 py-1.5 pl-24 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6"
|
67 |
placeholder="meta-llama/Llama-2-7b"
|
68 |
+
value={projectName}
|
69 |
+
onChange={(e) => setProjectName(e.target.value)}
|
70 |
+
onKeyDown={(e) => {
|
71 |
+
if (e.key === "Enter") {
|
72 |
+
onSubmit();
|
73 |
+
}
|
74 |
+
}}
|
75 |
/>
|
76 |
</div>
|
77 |
</div>
|
78 |
+
<div className="mt-16">
|
79 |
+
<svg className="line-chart"></svg>
|
80 |
+
</div>
|
81 |
</div>
|
82 |
</div>
|
83 |
);
|