victor HF staff commited on
Commit
964e49f
1 Parent(s): c18e96c

token modal

Browse files

save to local true by default

src/lib/components/InferencePlayground/InferencePlayground.svelte CHANGED
@@ -45,7 +45,7 @@
45
  let generatedTokensCount = 0;
46
  let abortController: AbortController | undefined = undefined;
47
  let waitForNonStreaming = true;
48
- let storeLocallyHfToken = false;
49
 
50
  const hfTokenLocalStorageKey = "hf-inference-token";
51
 
 
45
  let generatedTokensCount = 0;
46
  let abortController: AbortController | undefined = undefined;
47
  let waitForNonStreaming = true;
48
+ let storeLocallyHfToken = true;
49
 
50
  const hfTokenLocalStorageKey = "hf-inference-token";
51
 
src/lib/components/InferencePlayground/InferencePlaygroundHFTokenModal.svelte CHANGED
@@ -65,7 +65,7 @@
65
  alt="Hugging Face's logo"
66
  class="w-7"
67
  src="https://huggingface.co/front/assets/huggingface_logo-noborder.svg"
68
- /> Use a Hugging Face Token
69
  </h3>
70
  <button
71
  type="button"
@@ -77,14 +77,14 @@
77
  </button>
78
  </div>
79
  <!-- Modal body -->
80
- <div class="space-y-6 p-4 md:p-5">
81
- <p class="text-base leading-relaxed text-gray-700 2xl:text-balance dark:text-gray-400">
82
  You need a free Hugging Face token to use this application. <strong class="font-semibold"
83
  >Make sure you create a token with Inference API permission.</strong
84
  ><br /> Your token is kept safe by only being used from your browser.
85
  </p>
86
- <div class="mb-6">
87
- <label for="hf-token" class="mb-2 block text-sm font-medium text-gray-900 dark:text-white"
88
  >Hugging Face Token</label
89
  >
90
  <input
@@ -96,19 +96,10 @@
96
  class="block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-blue-500"
97
  />
98
  </div>
99
- <label class="flex items-center gap-x-1 text-gray-900 dark:text-gray-200">
100
  <input type="checkbox" bind:checked={storeLocallyHfToken} />
101
- <p class="leading-none">
102
- store locally <span class="text-gray-800 dark:text-gray-300"
103
- >(using <a
104
- href="https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage"
105
- target="_blank"
106
- class="underline"
107
- >
108
- localStorage
109
- </a> for the next use)</span
110
- >
111
- </p>
112
  </label>
113
  </div>
114
 
@@ -124,7 +115,7 @@
124
 
125
  <button
126
  type="submit"
127
- class="mb-2 me-2 rounded-lg bg-black px-5 py-2.5 text-sm font-medium text-white hover:bg-gray-900 focus:outline-none focus:ring-4 focus:ring-gray-300 dark:border-gray-700 dark:bg-gray-800 dark:hover:bg-gray-700 dark:focus:ring-gray-700"
128
  >Submit</button
129
  >
130
  </div>
 
65
  alt="Hugging Face's logo"
66
  class="w-7"
67
  src="https://huggingface.co/front/assets/huggingface_logo-noborder.svg"
68
+ /> Add a Hugging Face Token
69
  </h3>
70
  <button
71
  type="button"
 
77
  </button>
78
  </div>
79
  <!-- Modal body -->
80
+ <div class="p-4 md:p-5">
81
+ <p class="text-base leading-relaxed text-gray-800 2xl:text-balance dark:text-gray-400 mb-5">
82
  You need a free Hugging Face token to use this application. <strong class="font-semibold"
83
  >Make sure you create a token with Inference API permission.</strong
84
  ><br /> Your token is kept safe by only being used from your browser.
85
  </p>
86
+ <div>
87
+ <label for="hf-token" class="mb-3 block text-smd font-medium text-gray-900 dark:text-white "
88
  >Hugging Face Token</label
89
  >
90
  <input
 
96
  class="block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-blue-500"
97
  />
98
  </div>
99
+ <label class="flex items-center gap-x-1.5 text-gray-900 dark:text-gray-200 mt-4">
100
  <input type="checkbox" bind:checked={storeLocallyHfToken} />
101
+ <p class="leading-none text-sm">
102
+ Save to local storage for future use
 
 
 
 
 
 
 
 
 
103
  </label>
104
  </div>
105
 
 
115
 
116
  <button
117
  type="submit"
118
+ class="rounded-lg bg-black px-5 py-2.5 text-sm font-medium text-white hover:bg-gray-900 focus:outline-none focus:ring-4 focus:ring-gray-300 dark:border-gray-700 dark:bg-gray-800 dark:hover:bg-gray-700 dark:focus:ring-gray-700"
119
  >Submit</button
120
  >
121
  </div>