Spaces:
Running
Running
Upload folder using huggingface_hub
Browse files- App.tsx +23 -2
- README.md +1 -0
- components/Navbar.tsx +21 -3
- package-lock.json +93 -0
- package.json +1 -0
- production_server.log +1 -0
App.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
|
| 2 |
-
import React, { useState } from 'react';
|
|
|
|
| 3 |
import Navbar from './components/Navbar';
|
| 4 |
import Hero from './components/Hero';
|
| 5 |
import TrustedBy from './components/TrustedBy';
|
|
@@ -17,6 +18,26 @@ import ChatPage from './components/ChatPage';
|
|
| 17 |
|
| 18 |
function App() {
|
| 19 |
const [currentView, setCurrentView] = useState<'landing' | 'simulation' | 'conversation' | 'chat'>('landing');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
const startSimulation = () => {
|
| 22 |
setCurrentView('simulation');
|
|
@@ -59,7 +80,7 @@ function App() {
|
|
| 59 |
|
| 60 |
return (
|
| 61 |
<div className="bg-black min-h-screen text-white selection:bg-teal-500/30">
|
| 62 |
-
<Navbar onStart={startSimulation} />
|
| 63 |
<main>
|
| 64 |
<Hero onStart={startSimulation} />
|
| 65 |
<TrustedBy />
|
|
|
|
| 1 |
|
| 2 |
+
import React, { useState, useEffect } from 'react';
|
| 3 |
+
import { oauthLoginUrl, oauthHandleRedirectIfPresent } from "@huggingface/hub";
|
| 4 |
import Navbar from './components/Navbar';
|
| 5 |
import Hero from './components/Hero';
|
| 6 |
import TrustedBy from './components/TrustedBy';
|
|
|
|
| 18 |
|
| 19 |
function App() {
|
| 20 |
const [currentView, setCurrentView] = useState<'landing' | 'simulation' | 'conversation' | 'chat'>('landing');
|
| 21 |
+
const [user, setUser] = useState<any>(null);
|
| 22 |
+
|
| 23 |
+
useEffect(() => {
|
| 24 |
+
const handleAuth = async () => {
|
| 25 |
+
try {
|
| 26 |
+
const oauthResult = await oauthHandleRedirectIfPresent();
|
| 27 |
+
if (oauthResult) {
|
| 28 |
+
setUser(oauthResult.userInfo);
|
| 29 |
+
console.log("Logged in as:", oauthResult.userInfo);
|
| 30 |
+
}
|
| 31 |
+
} catch (error) {
|
| 32 |
+
console.error("Auth error:", error);
|
| 33 |
+
}
|
| 34 |
+
};
|
| 35 |
+
handleAuth();
|
| 36 |
+
}, []);
|
| 37 |
+
|
| 38 |
+
const loginWithHF = async () => {
|
| 39 |
+
window.location.href = await oauthLoginUrl();
|
| 40 |
+
};
|
| 41 |
|
| 42 |
const startSimulation = () => {
|
| 43 |
setCurrentView('simulation');
|
|
|
|
| 80 |
|
| 81 |
return (
|
| 82 |
<div className="bg-black min-h-screen text-white selection:bg-teal-500/30">
|
| 83 |
+
<Navbar onStart={startSimulation} onLogin={loginWithHF} user={user} />
|
| 84 |
<main>
|
| 85 |
<Hero onStart={startSimulation} />
|
| 86 |
<TrustedBy />
|
README.md
CHANGED
|
@@ -5,6 +5,7 @@ colorFrom: blue
|
|
| 5 |
colorTo: blue
|
| 6 |
sdk: docker
|
| 7 |
app_port: 7860
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
<div align="center">
|
|
|
|
| 5 |
colorTo: blue
|
| 6 |
sdk: docker
|
| 7 |
app_port: 7860
|
| 8 |
+
hf_oauth: true
|
| 9 |
---
|
| 10 |
|
| 11 |
<div align="center">
|
components/Navbar.tsx
CHANGED
|
@@ -5,9 +5,11 @@ import Button from './ui/Button';
|
|
| 5 |
|
| 6 |
interface NavbarProps {
|
| 7 |
onStart?: () => void;
|
|
|
|
|
|
|
| 8 |
}
|
| 9 |
|
| 10 |
-
const Navbar: React.FC<NavbarProps> = ({ onStart }) => {
|
| 11 |
const [isScrolled, setIsScrolled] = useState(false);
|
| 12 |
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);
|
| 13 |
|
|
@@ -46,7 +48,15 @@ const Navbar: React.FC<NavbarProps> = ({ onStart }) => {
|
|
| 46 |
))}
|
| 47 |
</div>
|
| 48 |
|
| 49 |
-
<div className="hidden md:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
<Button variant="primary" size="sm" onClick={onStart}>Start Building</Button>
|
| 51 |
</div>
|
| 52 |
|
|
@@ -73,7 +83,15 @@ const Navbar: React.FC<NavbarProps> = ({ onStart }) => {
|
|
| 73 |
{link.label}
|
| 74 |
</a>
|
| 75 |
))}
|
| 76 |
-
<div className="pt-4">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
<Button variant="primary" className="w-full" onClick={() => { setIsMobileMenuOpen(false); if(onStart) onStart(); }}>Start Building</Button>
|
| 78 |
</div>
|
| 79 |
</div>
|
|
|
|
| 5 |
|
| 6 |
interface NavbarProps {
|
| 7 |
onStart?: () => void;
|
| 8 |
+
onLogin?: () => void;
|
| 9 |
+
user?: any;
|
| 10 |
}
|
| 11 |
|
| 12 |
+
const Navbar: React.FC<NavbarProps> = ({ onStart, onLogin, user }) => {
|
| 13 |
const [isScrolled, setIsScrolled] = useState(false);
|
| 14 |
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);
|
| 15 |
|
|
|
|
| 48 |
))}
|
| 49 |
</div>
|
| 50 |
|
| 51 |
+
<div className="hidden md:flex items-center gap-4">
|
| 52 |
+
{user ? (
|
| 53 |
+
<div className="flex items-center gap-3 bg-gray-900 border border-gray-800 rounded-full px-4 py-1.5">
|
| 54 |
+
{user.avatarUrl && <img src={user.avatarUrl} alt={user.preferred_username} className="w-6 h-6 rounded-full" />}
|
| 55 |
+
<span className="text-sm font-medium text-gray-300">{user.preferred_username}</span>
|
| 56 |
+
</div>
|
| 57 |
+
) : (
|
| 58 |
+
<Button variant="outline" size="sm" onClick={onLogin}>Sign in with HF</Button>
|
| 59 |
+
)}
|
| 60 |
<Button variant="primary" size="sm" onClick={onStart}>Start Building</Button>
|
| 61 |
</div>
|
| 62 |
|
|
|
|
| 83 |
{link.label}
|
| 84 |
</a>
|
| 85 |
))}
|
| 86 |
+
<div className="pt-4 flex flex-col gap-3">
|
| 87 |
+
{user ? (
|
| 88 |
+
<div className="flex items-center gap-3 bg-gray-900 border border-gray-800 rounded-lg px-4 py-3">
|
| 89 |
+
{user.avatarUrl && <img src={user.avatarUrl} alt={user.preferred_username} className="w-8 h-8 rounded-full" />}
|
| 90 |
+
<span className="font-medium text-gray-300">{user.preferred_username}</span>
|
| 91 |
+
</div>
|
| 92 |
+
) : (
|
| 93 |
+
<Button variant="outline" className="w-full" onClick={() => { setIsMobileMenuOpen(false); if(onLogin) onLogin(); }}>Sign in with HF</Button>
|
| 94 |
+
)}
|
| 95 |
<Button variant="primary" className="w-full" onClick={() => { setIsMobileMenuOpen(false); if(onStart) onStart(); }}>Start Building</Button>
|
| 96 |
</div>
|
| 97 |
</div>
|
package-lock.json
CHANGED
|
@@ -9,6 +9,7 @@
|
|
| 9 |
"version": "0.0.0",
|
| 10 |
"dependencies": {
|
| 11 |
"@gradio/client": "^2.0.4",
|
|
|
|
| 12 |
"express": "^5.2.1",
|
| 13 |
"lucide-react": "^0.555.0",
|
| 14 |
"plotly.js": "2.30.0",
|
|
@@ -747,6 +748,30 @@
|
|
| 747 |
"node": ">=18.0.0"
|
| 748 |
}
|
| 749 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 750 |
"node_modules/@jridgewell/gen-mapping": {
|
| 751 |
"version": "0.3.13",
|
| 752 |
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
|
|
@@ -1620,6 +1645,16 @@
|
|
| 1620 |
"integrity": "sha512-0V/PkoculFl5+0Lp47JoxUcO0xSxhIBvm+BxHdD/OgXNmdRpRHCFnKVuUoWyS9EzQP+otSGv0m9Lb4yVkQBn2A==",
|
| 1621 |
"license": "MIT"
|
| 1622 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1623 |
"node_modules/array-bounds": {
|
| 1624 |
"version": "1.0.1",
|
| 1625 |
"resolved": "https://registry.npmjs.org/array-bounds/-/array-bounds-1.0.1.tgz",
|
|
@@ -2094,6 +2129,19 @@
|
|
| 2094 |
"integrity": "sha512-kgMuFyE78OC6Dyu3Dy7vcx4uy97EIbVxJB/B0eJ3bUNAkwdNcxYzgKltnyADiYwsR7SEqkkUPsEUT//OVS6XMA==",
|
| 2095 |
"license": "MIT"
|
| 2096 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2097 |
"node_modules/clsx": {
|
| 2098 |
"version": "2.1.1",
|
| 2099 |
"resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz",
|
|
@@ -2816,6 +2864,13 @@
|
|
| 2816 |
"integrity": "sha512-fGTi3gxV/23FTYdAoUtLYp6qySe2KE3teyZitipKNRuVYcBkoP/bB3guXN/XVKUe9mxCHXnc9C4ocyz8OmgN0g==",
|
| 2817 |
"license": "MIT"
|
| 2818 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2819 |
"node_modules/encodeurl": {
|
| 2820 |
"version": "2.0.0",
|
| 2821 |
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
|
|
@@ -3955,6 +4010,16 @@
|
|
| 3955 |
"node": ">=0.10.0"
|
| 3956 |
}
|
| 3957 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3958 |
"node_modules/is-generator-function": {
|
| 3959 |
"version": "1.1.2",
|
| 3960 |
"resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.1.2.tgz",
|
|
@@ -5846,6 +5911,34 @@
|
|
| 5846 |
"parenthesis": "^3.1.5"
|
| 5847 |
}
|
| 5848 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5849 |
"node_modules/strongly-connected-components": {
|
| 5850 |
"version": "1.0.1",
|
| 5851 |
"resolved": "https://registry.npmjs.org/strongly-connected-components/-/strongly-connected-components-1.0.1.tgz",
|
|
|
|
| 9 |
"version": "0.0.0",
|
| 10 |
"dependencies": {
|
| 11 |
"@gradio/client": "^2.0.4",
|
| 12 |
+
"@huggingface/hub": "^2.10.1",
|
| 13 |
"express": "^5.2.1",
|
| 14 |
"lucide-react": "^0.555.0",
|
| 15 |
"plotly.js": "2.30.0",
|
|
|
|
| 748 |
"node": ">=18.0.0"
|
| 749 |
}
|
| 750 |
},
|
| 751 |
+
"node_modules/@huggingface/hub": {
|
| 752 |
+
"version": "2.10.1",
|
| 753 |
+
"resolved": "https://registry.npmjs.org/@huggingface/hub/-/hub-2.10.1.tgz",
|
| 754 |
+
"integrity": "sha512-FVqG3qoqlynDBfL4SfWsA5A16e61PUaiWGlrvP4YaxWLrnvhQ+224IR7O3CKu23OqBNAppWG8rBinTInK88+uA==",
|
| 755 |
+
"license": "MIT",
|
| 756 |
+
"dependencies": {
|
| 757 |
+
"@huggingface/tasks": "^0.19.85"
|
| 758 |
+
},
|
| 759 |
+
"bin": {
|
| 760 |
+
"hfjs": "dist/cli.js"
|
| 761 |
+
},
|
| 762 |
+
"engines": {
|
| 763 |
+
"node": ">=18"
|
| 764 |
+
},
|
| 765 |
+
"optionalDependencies": {
|
| 766 |
+
"cli-progress": "^3.12.0"
|
| 767 |
+
}
|
| 768 |
+
},
|
| 769 |
+
"node_modules/@huggingface/tasks": {
|
| 770 |
+
"version": "0.19.85",
|
| 771 |
+
"resolved": "https://registry.npmjs.org/@huggingface/tasks/-/tasks-0.19.85.tgz",
|
| 772 |
+
"integrity": "sha512-4s5+GV257GRmT7Hrt190KlGsuq53IwFtCBj+J+bvoeIpn119589wY7WY/LS5VJMLwu7pUQnouLmMKeEOKO4BSQ==",
|
| 773 |
+
"license": "MIT"
|
| 774 |
+
},
|
| 775 |
"node_modules/@jridgewell/gen-mapping": {
|
| 776 |
"version": "0.3.13",
|
| 777 |
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
|
|
|
|
| 1645 |
"integrity": "sha512-0V/PkoculFl5+0Lp47JoxUcO0xSxhIBvm+BxHdD/OgXNmdRpRHCFnKVuUoWyS9EzQP+otSGv0m9Lb4yVkQBn2A==",
|
| 1646 |
"license": "MIT"
|
| 1647 |
},
|
| 1648 |
+
"node_modules/ansi-regex": {
|
| 1649 |
+
"version": "5.0.1",
|
| 1650 |
+
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
| 1651 |
+
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
| 1652 |
+
"license": "MIT",
|
| 1653 |
+
"optional": true,
|
| 1654 |
+
"engines": {
|
| 1655 |
+
"node": ">=8"
|
| 1656 |
+
}
|
| 1657 |
+
},
|
| 1658 |
"node_modules/array-bounds": {
|
| 1659 |
"version": "1.0.1",
|
| 1660 |
"resolved": "https://registry.npmjs.org/array-bounds/-/array-bounds-1.0.1.tgz",
|
|
|
|
| 2129 |
"integrity": "sha512-kgMuFyE78OC6Dyu3Dy7vcx4uy97EIbVxJB/B0eJ3bUNAkwdNcxYzgKltnyADiYwsR7SEqkkUPsEUT//OVS6XMA==",
|
| 2130 |
"license": "MIT"
|
| 2131 |
},
|
| 2132 |
+
"node_modules/cli-progress": {
|
| 2133 |
+
"version": "3.12.0",
|
| 2134 |
+
"resolved": "https://registry.npmjs.org/cli-progress/-/cli-progress-3.12.0.tgz",
|
| 2135 |
+
"integrity": "sha512-tRkV3HJ1ASwm19THiiLIXLO7Im7wlTuKnvkYaTkyoAPefqjNg7W7DHKUlGRxy9vxDvbyCYQkQozvptuMkGCg8A==",
|
| 2136 |
+
"license": "MIT",
|
| 2137 |
+
"optional": true,
|
| 2138 |
+
"dependencies": {
|
| 2139 |
+
"string-width": "^4.2.3"
|
| 2140 |
+
},
|
| 2141 |
+
"engines": {
|
| 2142 |
+
"node": ">=4"
|
| 2143 |
+
}
|
| 2144 |
+
},
|
| 2145 |
"node_modules/clsx": {
|
| 2146 |
"version": "2.1.1",
|
| 2147 |
"resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz",
|
|
|
|
| 2864 |
"integrity": "sha512-fGTi3gxV/23FTYdAoUtLYp6qySe2KE3teyZitipKNRuVYcBkoP/bB3guXN/XVKUe9mxCHXnc9C4ocyz8OmgN0g==",
|
| 2865 |
"license": "MIT"
|
| 2866 |
},
|
| 2867 |
+
"node_modules/emoji-regex": {
|
| 2868 |
+
"version": "8.0.0",
|
| 2869 |
+
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
| 2870 |
+
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
|
| 2871 |
+
"license": "MIT",
|
| 2872 |
+
"optional": true
|
| 2873 |
+
},
|
| 2874 |
"node_modules/encodeurl": {
|
| 2875 |
"version": "2.0.0",
|
| 2876 |
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
|
|
|
|
| 4010 |
"node": ">=0.10.0"
|
| 4011 |
}
|
| 4012 |
},
|
| 4013 |
+
"node_modules/is-fullwidth-code-point": {
|
| 4014 |
+
"version": "3.0.0",
|
| 4015 |
+
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
|
| 4016 |
+
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
|
| 4017 |
+
"license": "MIT",
|
| 4018 |
+
"optional": true,
|
| 4019 |
+
"engines": {
|
| 4020 |
+
"node": ">=8"
|
| 4021 |
+
}
|
| 4022 |
+
},
|
| 4023 |
"node_modules/is-generator-function": {
|
| 4024 |
"version": "1.1.2",
|
| 4025 |
"resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.1.2.tgz",
|
|
|
|
| 5911 |
"parenthesis": "^3.1.5"
|
| 5912 |
}
|
| 5913 |
},
|
| 5914 |
+
"node_modules/string-width": {
|
| 5915 |
+
"version": "4.2.3",
|
| 5916 |
+
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
|
| 5917 |
+
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
|
| 5918 |
+
"license": "MIT",
|
| 5919 |
+
"optional": true,
|
| 5920 |
+
"dependencies": {
|
| 5921 |
+
"emoji-regex": "^8.0.0",
|
| 5922 |
+
"is-fullwidth-code-point": "^3.0.0",
|
| 5923 |
+
"strip-ansi": "^6.0.1"
|
| 5924 |
+
},
|
| 5925 |
+
"engines": {
|
| 5926 |
+
"node": ">=8"
|
| 5927 |
+
}
|
| 5928 |
+
},
|
| 5929 |
+
"node_modules/strip-ansi": {
|
| 5930 |
+
"version": "6.0.1",
|
| 5931 |
+
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
| 5932 |
+
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
|
| 5933 |
+
"license": "MIT",
|
| 5934 |
+
"optional": true,
|
| 5935 |
+
"dependencies": {
|
| 5936 |
+
"ansi-regex": "^5.0.1"
|
| 5937 |
+
},
|
| 5938 |
+
"engines": {
|
| 5939 |
+
"node": ">=8"
|
| 5940 |
+
}
|
| 5941 |
+
},
|
| 5942 |
"node_modules/strongly-connected-components": {
|
| 5943 |
"version": "1.0.1",
|
| 5944 |
"resolved": "https://registry.npmjs.org/strongly-connected-components/-/strongly-connected-components-1.0.1.tgz",
|
package.json
CHANGED
|
@@ -10,6 +10,7 @@
|
|
| 10 |
},
|
| 11 |
"dependencies": {
|
| 12 |
"@gradio/client": "^2.0.4",
|
|
|
|
| 13 |
"express": "^5.2.1",
|
| 14 |
"lucide-react": "^0.555.0",
|
| 15 |
"plotly.js": "2.30.0",
|
|
|
|
| 10 |
},
|
| 11 |
"dependencies": {
|
| 12 |
"@gradio/client": "^2.0.4",
|
| 13 |
+
"@huggingface/hub": "^2.10.1",
|
| 14 |
"express": "^5.2.1",
|
| 15 |
"lucide-react": "^0.555.0",
|
| 16 |
"plotly.js": "2.30.0",
|
production_server.log
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Server running on port 7860
|