Faran Butt commited on
Commit
43affd4
·
1 Parent(s): 2157d4f

Added New endpoints

Browse files
Files changed (1) hide show
  1. src/pages/index.tsx +15 -11
src/pages/index.tsx CHANGED
@@ -5,6 +5,7 @@ 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('');
@@ -13,20 +14,23 @@ export default function Home() {
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
  }
 
5
  import { Button } from "@/components/ui/button";
6
  import { Input } from "@/components/ui/input";
7
  import { client } from "@gradio/client";
8
+ import axios from "axios";
9
  export default function Home() {
10
  const [file,setFile] = useState(null);
11
  const [result,setResult] = useState('');
 
14
 
15
  const handleFileChange = (event:any) => {
16
  console.log(event.target.files[0])
17
+ setFile(event.target.files[0].name);
18
  }
19
  const SendFile = async() => {
20
+ console.log("File Recieved: ",file)
21
+ console.log("Query Recieved: ",query)
22
+ console.log("Collection Recieved: ",collection)
23
  try{
24
+ const url = 'https://teamtonic-herechatbackend.hf.space/combined_interface';
25
+ const data = {
26
+ data: [query, file, collection]
27
+ };
28
+ const response = await axios.post(url, data, {
29
+ headers: {
30
+ 'Content-Type': 'application/json'
31
+ }
32
+ })
33
+ console.log(response)
34
  }catch(error){
35
  console.error('Error:', error);
36
  }