Faran Butt
commited on
Commit
β’
2157d4f
1
Parent(s):
dbb1f9d
Added Endpoints
Browse files- backend/.env +4 -0
- package-lock.json +69 -0
- package.json +1 -0
- src/pages/_app.tsx +1 -1
- src/pages/api/env.ts +9 -9
- src/pages/index.tsx +35 -14
backend/.env
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
WEAVIATE=WW6e7xNEj8czLsRwGaUqYChOUQ9QjkKbEsWP
|
2 |
+
WEAVIATE_URL=https://herechat-myg0g1v1.weaviate.network
|
3 |
+
WEAVIATE_USERNAME=faranbutt789
|
4 |
+
WEAVIATE_PASSWORD=ASdf0987!
|
package-lock.json
CHANGED
@@ -35,6 +35,7 @@
|
|
35 |
"typescript": "5.0.4"
|
36 |
},
|
37 |
"devDependencies": {
|
|
|
38 |
"autoprefixer": "^10.4.16",
|
39 |
"postcss": "^8.4.31",
|
40 |
"tailwindcss": "^3.3.5"
|
@@ -433,6 +434,20 @@
|
|
433 |
"resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.1.6.tgz",
|
434 |
"integrity": "sha512-OfX7E2oUDYxtBvsuS4e/jSn4Q9Qb6DzgeYtsAdkPZ47znpoNsMgZw0+tVijiv3uGNR6dgNlty6r9rzIzHjtd/A=="
|
435 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
436 |
"node_modules/@huggingface/inference": {
|
437 |
"version": "2.3.3",
|
438 |
"resolved": "https://registry.npmjs.org/@huggingface/inference/-/inference-2.3.3.tgz",
|
@@ -1968,6 +1983,19 @@
|
|
1968 |
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-0.1.2.tgz",
|
1969 |
"integrity": "sha512-RiWIenusJsmI2KcvqQABB83tLxCByE3upSP8QU3rJDMVFGPWLvPQJt/O1Su9moRWeH7d+Q2HYb68f6+v+tw2vg=="
|
1970 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1971 |
"node_modules/bundle-name": {
|
1972 |
"version": "3.0.0",
|
1973 |
"resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-3.0.0.tgz",
|
@@ -4230,6 +4258,17 @@
|
|
4230 |
"node": "^10 || ^12 || >=14"
|
4231 |
}
|
4232 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4233 |
"node_modules/node-releases": {
|
4234 |
"version": "2.0.13",
|
4235 |
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz",
|
@@ -5056,6 +5095,15 @@
|
|
5056 |
"loose-envify": "^1.1.0"
|
5057 |
}
|
5058 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5059 |
"node_modules/semver": {
|
5060 |
"version": "7.5.1",
|
5061 |
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.1.tgz",
|
@@ -5719,6 +5767,27 @@
|
|
5719 |
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
5720 |
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
|
5721 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5722 |
"node_modules/xtend": {
|
5723 |
"version": "2.1.2",
|
5724 |
"resolved": "https://registry.npmjs.org/xtend/-/xtend-2.1.2.tgz",
|
|
|
35 |
"typescript": "5.0.4"
|
36 |
},
|
37 |
"devDependencies": {
|
38 |
+
"@gradio/client": "^0.8.1",
|
39 |
"autoprefixer": "^10.4.16",
|
40 |
"postcss": "^8.4.31",
|
41 |
"tailwindcss": "^3.3.5"
|
|
|
434 |
"resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.1.6.tgz",
|
435 |
"integrity": "sha512-OfX7E2oUDYxtBvsuS4e/jSn4Q9Qb6DzgeYtsAdkPZ47znpoNsMgZw0+tVijiv3uGNR6dgNlty6r9rzIzHjtd/A=="
|
436 |
},
|
437 |
+
"node_modules/@gradio/client": {
|
438 |
+
"version": "0.8.1",
|
439 |
+
"resolved": "https://registry.npmjs.org/@gradio/client/-/client-0.8.1.tgz",
|
440 |
+
"integrity": "sha512-qMFINw6MbubLYQiLorwGhyapH7bUSthH+7tevGgKOPuQWoW5TliPi95VEFRUQ+d2Y/vXqWj0+hubO94RO7v/7w==",
|
441 |
+
"dev": true,
|
442 |
+
"dependencies": {
|
443 |
+
"bufferutil": "^4.0.7",
|
444 |
+
"semiver": "^1.1.0",
|
445 |
+
"ws": "^8.13.0"
|
446 |
+
},
|
447 |
+
"engines": {
|
448 |
+
"node": ">=18.0.0"
|
449 |
+
}
|
450 |
+
},
|
451 |
"node_modules/@huggingface/inference": {
|
452 |
"version": "2.3.3",
|
453 |
"resolved": "https://registry.npmjs.org/@huggingface/inference/-/inference-2.3.3.tgz",
|
|
|
1983 |
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-0.1.2.tgz",
|
1984 |
"integrity": "sha512-RiWIenusJsmI2KcvqQABB83tLxCByE3upSP8QU3rJDMVFGPWLvPQJt/O1Su9moRWeH7d+Q2HYb68f6+v+tw2vg=="
|
1985 |
},
|
1986 |
+
"node_modules/bufferutil": {
|
1987 |
+
"version": "4.0.8",
|
1988 |
+
"resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.8.tgz",
|
1989 |
+
"integrity": "sha512-4T53u4PdgsXqKaIctwF8ifXlRTTmEPJ8iEPWFdGZvcf7sbwYo6FKFEX9eNNAnzFZ7EzJAQ3CJeOtCRA4rDp7Pw==",
|
1990 |
+
"dev": true,
|
1991 |
+
"hasInstallScript": true,
|
1992 |
+
"dependencies": {
|
1993 |
+
"node-gyp-build": "^4.3.0"
|
1994 |
+
},
|
1995 |
+
"engines": {
|
1996 |
+
"node": ">=6.14.2"
|
1997 |
+
}
|
1998 |
+
},
|
1999 |
"node_modules/bundle-name": {
|
2000 |
"version": "3.0.0",
|
2001 |
"resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-3.0.0.tgz",
|
|
|
4258 |
"node": "^10 || ^12 || >=14"
|
4259 |
}
|
4260 |
},
|
4261 |
+
"node_modules/node-gyp-build": {
|
4262 |
+
"version": "4.6.1",
|
4263 |
+
"resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.1.tgz",
|
4264 |
+
"integrity": "sha512-24vnklJmyRS8ViBNI8KbtK/r/DmXQMRiOMXTNz2nrTnAYUwjmEEbnnpB/+kt+yWRv73bPsSPRFddrcIbAxSiMQ==",
|
4265 |
+
"dev": true,
|
4266 |
+
"bin": {
|
4267 |
+
"node-gyp-build": "bin.js",
|
4268 |
+
"node-gyp-build-optional": "optional.js",
|
4269 |
+
"node-gyp-build-test": "build-test.js"
|
4270 |
+
}
|
4271 |
+
},
|
4272 |
"node_modules/node-releases": {
|
4273 |
"version": "2.0.13",
|
4274 |
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz",
|
|
|
5095 |
"loose-envify": "^1.1.0"
|
5096 |
}
|
5097 |
},
|
5098 |
+
"node_modules/semiver": {
|
5099 |
+
"version": "1.1.0",
|
5100 |
+
"resolved": "https://registry.npmjs.org/semiver/-/semiver-1.1.0.tgz",
|
5101 |
+
"integrity": "sha512-QNI2ChmuioGC1/xjyYwyZYADILWyW6AmS1UH6gDj/SFUUUS4MBAWs/7mxnkRPc/F4iHezDP+O8t0dO8WHiEOdg==",
|
5102 |
+
"dev": true,
|
5103 |
+
"engines": {
|
5104 |
+
"node": ">=6"
|
5105 |
+
}
|
5106 |
+
},
|
5107 |
"node_modules/semver": {
|
5108 |
"version": "7.5.1",
|
5109 |
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.1.tgz",
|
|
|
5767 |
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
5768 |
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
|
5769 |
},
|
5770 |
+
"node_modules/ws": {
|
5771 |
+
"version": "8.14.2",
|
5772 |
+
"resolved": "https://registry.npmjs.org/ws/-/ws-8.14.2.tgz",
|
5773 |
+
"integrity": "sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g==",
|
5774 |
+
"dev": true,
|
5775 |
+
"engines": {
|
5776 |
+
"node": ">=10.0.0"
|
5777 |
+
},
|
5778 |
+
"peerDependencies": {
|
5779 |
+
"bufferutil": "^4.0.1",
|
5780 |
+
"utf-8-validate": ">=5.0.2"
|
5781 |
+
},
|
5782 |
+
"peerDependenciesMeta": {
|
5783 |
+
"bufferutil": {
|
5784 |
+
"optional": true
|
5785 |
+
},
|
5786 |
+
"utf-8-validate": {
|
5787 |
+
"optional": true
|
5788 |
+
}
|
5789 |
+
}
|
5790 |
+
},
|
5791 |
"node_modules/xtend": {
|
5792 |
"version": "2.1.2",
|
5793 |
"resolved": "https://registry.npmjs.org/xtend/-/xtend-2.1.2.tgz",
|
package.json
CHANGED
@@ -50,6 +50,7 @@
|
|
50 |
"typescript": "5.0.4"
|
51 |
},
|
52 |
"devDependencies": {
|
|
|
53 |
"autoprefixer": "^10.4.16",
|
54 |
"postcss": "^8.4.31",
|
55 |
"tailwindcss": "^3.3.5"
|
|
|
50 |
"typescript": "5.0.4"
|
51 |
},
|
52 |
"devDependencies": {
|
53 |
+
"@gradio/client": "^0.8.1",
|
54 |
"autoprefixer": "^10.4.16",
|
55 |
"postcss": "^8.4.31",
|
56 |
"tailwindcss": "^3.3.5"
|
src/pages/_app.tsx
CHANGED
@@ -6,7 +6,7 @@ import CssBaseline from "@mui/material/CssBaseline";
|
|
6 |
import { CacheProvider, EmotionCache } from "@emotion/react";
|
7 |
import theme from "@/lib/theme";
|
8 |
import createEmotionCache from "@/lib/createEmotionCache";
|
9 |
-
|
10 |
// Client-side cache, shared for the whole session of the user in the browser.
|
11 |
const clientSideEmotionCache = createEmotionCache();
|
12 |
|
|
|
6 |
import { CacheProvider, EmotionCache } from "@emotion/react";
|
7 |
import theme from "@/lib/theme";
|
8 |
import createEmotionCache from "@/lib/createEmotionCache";
|
9 |
+
import {client} from '@gradio/client';
|
10 |
// Client-side cache, shared for the whole session of the user in the browser.
|
11 |
const clientSideEmotionCache = createEmotionCache();
|
12 |
|
src/pages/api/env.ts
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
-
import process from "node:process";
|
2 |
-
import { NextApiRequest, NextApiResponse } from "next";
|
3 |
|
4 |
-
export default async function handler(
|
5 |
-
|
6 |
-
|
7 |
-
) {
|
8 |
-
|
9 |
|
10 |
-
|
11 |
-
}
|
|
|
1 |
+
// import process from "node:process";
|
2 |
+
// import { NextApiRequest, NextApiResponse } from "next";
|
3 |
|
4 |
+
// export default async function handler(
|
5 |
+
// request: NextApiRequest,
|
6 |
+
// response: NextApiResponse
|
7 |
+
// ) {
|
8 |
+
// const exampleSecret = process.env.HF_EXAMPLE_SECRET;
|
9 |
|
10 |
+
// return response.status(200).json({ HF_EXAMPLE_SECRET: exampleSecret });
|
11 |
+
// }
|
src/pages/index.tsx
CHANGED
@@ -1,26 +1,32 @@
|
|
|
|
1 |
import Head from "next/head";
|
2 |
import Link from "next/link";
|
3 |
import { useState } from "react";
|
4 |
import { Button } from "@/components/ui/button";
|
5 |
import { Input } from "@/components/ui/input";
|
6 |
-
import
|
7 |
export default function Home() {
|
8 |
const [file,setFile] = useState(null);
|
9 |
const [result,setResult] = useState('');
|
|
|
|
|
|
|
10 |
const handleFileChange = (event:any) => {
|
11 |
console.log(event.target.files[0])
|
12 |
setFile(event.target.files[0]);
|
13 |
}
|
14 |
const SendFile = async() => {
|
|
|
|
|
|
|
15 |
try{
|
16 |
-
const
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
})
|
24 |
}catch(error){
|
25 |
console.error('Error:', error);
|
26 |
}
|
@@ -46,12 +52,27 @@ export default function Home() {
|
|
46 |
</div>
|
47 |
|
48 |
<div className=''>
|
49 |
-
<div className="
|
50 |
-
<div className="">
|
51 |
-
<
|
52 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
</div>
|
54 |
-
<Button className='border-2 border-blue-500 bg-white text-blue-500 font-bold hover:text-white hover:bg-blue-500' disabled={!file} onClick={SendFile} >Submit</Button>
|
55 |
</div>
|
56 |
</div>
|
57 |
</div>
|
|
|
1 |
+
|
2 |
import Head from "next/head";
|
3 |
import Link from "next/link";
|
4 |
import { useState } from "react";
|
5 |
import { Button } from "@/components/ui/button";
|
6 |
import { Input } from "@/components/ui/input";
|
7 |
+
import { client } from "@gradio/client";
|
8 |
export default function Home() {
|
9 |
const [file,setFile] = useState(null);
|
10 |
const [result,setResult] = useState('');
|
11 |
+
const [query,setQuery] = useState('');
|
12 |
+
const [collection,setCollection] = useState('');
|
13 |
+
|
14 |
const handleFileChange = (event:any) => {
|
15 |
console.log(event.target.files[0])
|
16 |
setFile(event.target.files[0]);
|
17 |
}
|
18 |
const SendFile = async() => {
|
19 |
+
console.log("File Recieved",file)
|
20 |
+
console.log("Query Recieved",query)
|
21 |
+
console.log("Collection Recieved",collection)
|
22 |
try{
|
23 |
+
//const app = await client('https://teamtonic-herechatbackend.hf.space/--replicas/jfflh/',{hf_token:'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'});
|
24 |
+
// const result:any = await app.predict("/predict", [
|
25 |
+
// "Hello!!", // string in 'Query' Textbox component
|
26 |
+
// file, // blob in 'PDF File' File component
|
27 |
+
// "Hello!!", // string in 'Collection Name' Textbox component
|
28 |
+
// ]);
|
29 |
+
// console.log(result.data);
|
|
|
30 |
}catch(error){
|
31 |
console.error('Error:', error);
|
32 |
}
|
|
|
52 |
</div>
|
53 |
|
54 |
<div className=''>
|
55 |
+
<div className="">
|
56 |
+
<div className="flex flex-col justify-center items-center gap-4">
|
57 |
+
<div className="flex justify-center gap-4">
|
58 |
+
<div>
|
59 |
+
<label htmlFor="" className="font-bold text-3xl">Enter Query</label>
|
60 |
+
<Input type='text' onChange={(e)=>setQuery(e.target.value)}/>
|
61 |
+
</div>
|
62 |
+
<div>
|
63 |
+
<label htmlFor="" className="font-bold text-3xl">Enter Document</label>
|
64 |
+
<Input type='file' onChange={handleFileChange}/>
|
65 |
+
<p className="mt-1 text-sm text-gray-500 dark:text-gray-300" id="file_input_help">TXT, DOCX, PPTX, JPG, PNG, HTML or PDF</p>
|
66 |
+
</div>
|
67 |
+
<div>
|
68 |
+
<label htmlFor="" className="font-bold text-3xl">Collection</label>
|
69 |
+
<Input type='text' onChange={(e) => setCollection(e.target.value)}/>
|
70 |
+
</div>
|
71 |
+
</div>
|
72 |
+
<div>
|
73 |
+
<Button className='border-2 border-blue-500 bg-white text-blue-500 font-bold hover:text-white hover:bg-blue-500' disabled={!file} onClick={SendFile} >Submit</Button>
|
74 |
+
</div>
|
75 |
</div>
|
|
|
76 |
</div>
|
77 |
</div>
|
78 |
</div>
|