Spaces:
Running
Running
File size: 758 Bytes
2f921c8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | import { InferenceClient } from "@huggingface/inference";
import { useState } from "react";
export default function TokenInput({ onHFClientReady }) {
const [token, setToken] = useState("");
const handleConfirm = async () => {
if (!token.trim()) return;
const client = new InferenceClient(token);
onHFClientReady(client);
};
return (
<div style={{ display: "flex", gap: "10px" }}>
<input
type="password"
value={token}
onChange={(e) => setToken(e.target.value)}
placeholder="Enter Hugging Face token"
style={{ flex: 1, padding: "10px", fontSize: "16px" }}
/>
<button onClick={handleConfirm} style={{ padding: "10px 20px" }}>
Confirm
</button>
</div>
);
}
|