Spaces:
Paused
Paused
matt HOFFNER
commited on
Commit
Β·
85388fa
1
Parent(s):
0e4a91a
improve loading ux
Browse files- README.md +6 -1
- src/app/home.tsx +1 -1
- src/app/layout.tsx +2 -2
- src/components/embeddingsWorker.js +1 -0
README.md
CHANGED
|
@@ -12,4 +12,9 @@ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-
|
|
| 12 |
|
| 13 |
# Edge PDF Chat
|
| 14 |
|
| 15 |
-
Demo using
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
# Edge PDF Chat
|
| 14 |
|
| 15 |
+
Demo using Web Workers with Next.js to create a client side vector store for chat with PDF.
|
| 16 |
+
|
| 17 |
+
## Libraries used
|
| 18 |
+
|
| 19 |
+
* transformers.js
|
| 20 |
+
* pdfjs-dist
|
src/app/home.tsx
CHANGED
|
@@ -115,7 +115,7 @@ const Home: React.FC = () => {
|
|
| 115 |
onChange={handleInputChange}
|
| 116 |
placeholder="Say something..."
|
| 117 |
/>
|
| 118 |
-
<button type="submit" className={styles.sendButton}>Send</button>
|
| 119 |
</form>
|
| 120 |
</div>
|
| 121 |
|
|
|
|
| 115 |
onChange={handleInputChange}
|
| 116 |
placeholder="Say something..."
|
| 117 |
/>
|
| 118 |
+
{(searchInProgress || isLoading) ? <button type="submit" disabled={true} className={styles.sendButton}>Loading</button> : <button type="submit" className={styles.sendButton}>Send</button>}
|
| 119 |
</form>
|
| 120 |
</div>
|
| 121 |
|
src/app/layout.tsx
CHANGED
|
@@ -5,8 +5,8 @@ import './globals.css'
|
|
| 5 |
const inter = Inter({ subsets: ['latin'] })
|
| 6 |
|
| 7 |
export const metadata: Metadata = {
|
| 8 |
-
title: '
|
| 9 |
-
description: '
|
| 10 |
}
|
| 11 |
|
| 12 |
export default function RootLayout({
|
|
|
|
| 5 |
const inter = Inter({ subsets: ['latin'] })
|
| 6 |
|
| 7 |
export const metadata: Metadata = {
|
| 8 |
+
title: 'Edge PDF Chat',
|
| 9 |
+
description: 'Chat with PDF',
|
| 10 |
}
|
| 11 |
|
| 12 |
export default function RootLayout({
|
src/components/embeddingsWorker.js
CHANGED
|
@@ -88,6 +88,7 @@ class EmbeddingsWorker {
|
|
| 88 |
}
|
| 89 |
|
| 90 |
const worker = new EmbeddingsWorker();
|
|
|
|
| 91 |
|
| 92 |
self.addEventListener('message', async (event) => {
|
| 93 |
if (event.data.action === 'addDocumentsToStore') {
|
|
|
|
| 88 |
}
|
| 89 |
|
| 90 |
const worker = new EmbeddingsWorker();
|
| 91 |
+
worker.loadClient();
|
| 92 |
|
| 93 |
self.addEventListener('message', async (event) => {
|
| 94 |
if (event.data.action === 'addDocumentsToStore') {
|