Spaces:
Running on Zero
Running on Zero
Bump anon gen allowance from 1 to 2 before login gate
Browse filesCo-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- static/action-variants.jsx +3 -3
- static/index.html +9 -7
static/action-variants.jsx
CHANGED
|
@@ -16,10 +16,10 @@ const FIGURES = [
|
|
| 16 |
|
| 17 |
const MODEL_URL = 'https://huggingface.co/systms/SYSTMS-ACTION-LoRA-Qwen-Image-Edit-2511';
|
| 18 |
|
| 19 |
-
function HeroVariant({ onFile, heroImage, loggedIn,
|
| 20 |
const inputRef = React.useRef();
|
| 21 |
-
// Anon users get
|
| 22 |
-
const gateActive = loggedIn === false &&
|
| 23 |
|
| 24 |
return (
|
| 25 |
<div className="v-hero-wrap">
|
|
|
|
| 16 |
|
| 17 |
const MODEL_URL = 'https://huggingface.co/systms/SYSTMS-ACTION-LoRA-Qwen-Image-Edit-2511';
|
| 18 |
|
| 19 |
+
function HeroVariant({ onFile, heroImage, loggedIn, anonGenCount = 0, anonGenLimit = 2 }) {
|
| 20 |
const inputRef = React.useRef();
|
| 21 |
+
// Anon users get a few free gens; after that we route them to /login.
|
| 22 |
+
const gateActive = loggedIn === false && anonGenCount >= anonGenLimit;
|
| 23 |
|
| 24 |
return (
|
| 25 |
<div className="v-hero-wrap">
|
static/index.html
CHANGED
|
@@ -131,10 +131,11 @@
|
|
| 131 |
const [beforeUrl, setBeforeUrl] = React.useState(null);
|
| 132 |
// null = unknown (still fetching /me), true/false once we know
|
| 133 |
const [loggedIn, setLoggedIn] = React.useState(null);
|
| 134 |
-
//
|
| 135 |
-
//
|
| 136 |
-
const
|
| 137 |
-
|
|
|
|
| 138 |
});
|
| 139 |
|
| 140 |
React.useEffect(() => {
|
|
@@ -182,8 +183,9 @@
|
|
| 182 |
setResultUrl(url);
|
| 183 |
setPhase('result');
|
| 184 |
if (loggedIn === false) {
|
| 185 |
-
|
| 186 |
-
|
|
|
|
| 187 |
}
|
| 188 |
};
|
| 189 |
const onError = () => {
|
|
@@ -200,7 +202,7 @@
|
|
| 200 |
|
| 201 |
return (
|
| 202 |
<>
|
| 203 |
-
<HeroVariant onFile={onFile} heroImage={heroImage} loggedIn={loggedIn}
|
| 204 |
<SampleStrip />
|
| 205 |
<ProcessingModal open={phase === 'processing'} file={file} onDone={onDone} onError={onError} onClose={onClose} />
|
| 206 |
<ResultModal open={phase === 'result'} beforeUrl={beforeUrl} afterUrl={resultUrl} onClose={onClose} />
|
|
|
|
| 131 |
const [beforeUrl, setBeforeUrl] = React.useState(null);
|
| 132 |
// null = unknown (still fetching /me), true/false once we know
|
| 133 |
const [loggedIn, setLoggedIn] = React.useState(null);
|
| 134 |
+
// Anon users get ANON_GEN_LIMIT free gens before being gated to /login.
|
| 135 |
+
// Count persisted in localStorage so it survives reloads.
|
| 136 |
+
const ANON_GEN_LIMIT = 2;
|
| 137 |
+
const [anonGenCount, setAnonGenCount] = React.useState(() => {
|
| 138 |
+
try { return parseInt(localStorage.getItem('action_anon_count') || '0', 10) || 0; } catch { return 0; }
|
| 139 |
});
|
| 140 |
|
| 141 |
React.useEffect(() => {
|
|
|
|
| 183 |
setResultUrl(url);
|
| 184 |
setPhase('result');
|
| 185 |
if (loggedIn === false) {
|
| 186 |
+
const next = anonGenCount + 1;
|
| 187 |
+
try { localStorage.setItem('action_anon_count', String(next)); } catch {}
|
| 188 |
+
setAnonGenCount(next);
|
| 189 |
}
|
| 190 |
};
|
| 191 |
const onError = () => {
|
|
|
|
| 202 |
|
| 203 |
return (
|
| 204 |
<>
|
| 205 |
+
<HeroVariant onFile={onFile} heroImage={heroImage} loggedIn={loggedIn} anonGenCount={anonGenCount} anonGenLimit={ANON_GEN_LIMIT} />
|
| 206 |
<SampleStrip />
|
| 207 |
<ProcessingModal open={phase === 'processing'} file={file} onDone={onDone} onError={onError} onClose={onClose} />
|
| 208 |
<ResultModal open={phase === 'result'} beforeUrl={beforeUrl} afterUrl={resultUrl} onClose={onClose} />
|