Commit d3cac160 authored by Madhushan Liyanage's avatar Madhushan Liyanage

Merge branch 'master' into Madhushan-K.L.B-DEV

parents f5f32296 948a40fe
...@@ -11,6 +11,7 @@ import Login from './pages/Login'; ...@@ -11,6 +11,7 @@ import Login from './pages/Login';
import Register from './pages/Register'; import Register from './pages/Register';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import Test from './pages/Test'; import Test from './pages/Test';
import AudioToSign from './pages/AudioToSign';
function App() { function App() {
const[isLogged, setIsLogged] = useState(sessionStorage.getItem("isLogged")); const[isLogged, setIsLogged] = useState(sessionStorage.getItem("isLogged"));
...@@ -30,6 +31,7 @@ function App() { ...@@ -30,6 +31,7 @@ function App() {
<Routes> <Routes>
{/* <Route path='*' element={<VideoToSign/>}/> */} {/* <Route path='*' element={<VideoToSign/>}/> */}
<Route exact path='/sign-detection' element={<VideoToSign/>}/> <Route exact path='/sign-detection' element={<VideoToSign/>}/>
<Route exact path='/audio-to-sign' element={<AudioToSign/>}/>
</Routes> </Routes>
</div> </div>
......
...@@ -31,7 +31,7 @@ function SideNavBar() { ...@@ -31,7 +31,7 @@ function SideNavBar() {
{/* සංඥා ශබ්දකෝෂය */} {/* සංඥා ශබ්දකෝෂය */}
<NavLink exact to="/about" className="nav-link main-nav-link" activeClassName="active-link">ix&#123;d YíofldaIh</NavLink> <NavLink exact to="/about" className="nav-link main-nav-link" activeClassName="active-link">ix&#123;d YíofldaIh</NavLink>
{/* ශබ්ද පරිවර්ථකය */} {/* ශබ්ද පරිවර්ථකය */}
<NavLink exact to="/contact" className="nav-link main-nav-link" activeClassName="active-link">Yío mßj¾:lh</NavLink> <NavLink exact to="/audio-to-sign" className="nav-link main-nav-link" activeClassName="active-link">Yío mßj¾:lh</NavLink>
{/* සංඥා හඳුනාගැනීම */} {/* සංඥා හඳුනාගැනීම */}
<NavLink exact to="/sign-detection" className="nav-link main-nav-link " activeClassName="active-link">ix&#123;d y÷kd.ekSu</NavLink> <NavLink exact to="/sign-detection" className="nav-link main-nav-link " activeClassName="active-link">ix&#123;d y÷kd.ekSu</NavLink>
{/* වාචික පුහුණුව */} {/* වාචික පුහුණුව */}
......
import React, { useState } from 'react';
import axios from 'axios';
import { useRecordWebcam } from 'react-record-webcam';
import RestService from "../services/RestService";
import '../styles/audioToSign.css';
const AudioToSign = () => {
const [file, setFile] = useState(null);
const handleFileChange = (event) => {
const selectedFile = event.target.files[0];
setFile(selectedFile);
};
// const handleUpload = () => {
// if (file) {
// try {
// const formData = new FormData();
// formData.append('audio1', file);
// axios.post('http://127.0.0.1:5000/uploadaudio', formData, {
// //axios.get('http://localhost:9000/', formData, {
// headers: {
// 'Content-Type': 'multipart/form-data',
// },
// });
// console.log('File uploaded successfully!');
// } catch (error) {
// console.error('Error uploading file:', error);
// }
// }
// };
//*************************************************** */
const [videoFile, setVideoFile] = useState(null);
const [audioFile, setAudioFile] = useState([]);
const handleVideoFileChange = (event) => {
setVideoFile(event.target.files[0]);
};
const handleAudioFileChange = (event) => {
setAudioFile(event.target.files[0]);
};
const handleVideoUpload = () => {
if (videoFile) {
const formData = new FormData();
formData.append('video', videoFile);
axios.post('http://127.0.0.1:5000/transcribe-audio', formData)
.then(response => {
console.log('Video uploaded successfully');
})
.catch(error => {
console.error('Error:', error);
});
}
};
const handleAudioUpload = () => {
console.log(audioFile)
const formData = new FormData();
formData.append('audio1', audioFile);
axios.post('http://127.0.0.1:5000/transcribe-audio', formData)
.then(response => {
console.log(response);
console.log('Audio uploaded successfully');
})
.catch(error => {
console.error('Error:', error);
});
};
return (
<div className="col col-lg-12">
<div className='row'>
<h1>Upload Video</h1>
</div>
<div className='row'>
<input type="file" accept="video/*" onChange={handleVideoFileChange} />
{/* <button onClick={handleVideoUpload}>Upload Video</button> */}
<button className="btn video-btn" onClick={handleVideoUpload}>Upload Video</button>
</div>
<div className='row'>
<h1>Upload Audio</h1>
</div>
<div className='row'>
<input type="file" onChange={(e)=>setAudioFile(e.target.files[0])} />
{/* <button onClick={handleAudioUpload}>Upload Audio</button> */}
<button className="btn video-btn" onClick={handleAudioUpload}>Upload Audio</button>
</div>
<br/>
<div className="row">
<div className="col-6 col-sm-4">
<h3 className="mt-4" style={{fontFamily:'FMAbayaBld'}}>w¾:h ( </h3>
<h1 className="d-flex align-items-center justify-content-center" >ffffs</h1>
</div>
<div class="col-6 col-sm-4">
<video autoPlay muted className="video-box1"/>
</div>
</div>
</div>
);
};
export default AudioToSign;
.video-box1 {
border-width: 3px;
border-color:#af2c00;
border-style: solid;
border-radius: 2vw;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.552), 0 10px 10px 0 rgba(0, 0, 0, 0.338);
/* box-shadow: 0 1px 10px 0 rgba(66, 66, 66, 0.336), 0 6px 20px 0 rgba(100, 100, 100, 0.082); */
/* width: 40vw; */
height: 45vh;
width: 65vh;
align-items: center;
background-color: black;
background-image: url('../images/Skulls.jpg');
}
.aa {
align-items: end;
}
.card {
align-items: end;
width: 100%;
background-color: transparent;
border-color: transparent;
}
section {
margin: 20px;
}
input::-webkit-file-upload-button {
position: absolute;
padding: 6px 15px;
background-color: rgb(230, 154, 78);
border: none;
border-radius: 5px;
color: white;
text-transform: uppercase;
box-shadow: 0px 3px 3px -2px rgba(0,0,0,0.2), 0px 3px 4px 0px rgba(0,0,0,0.14), 0px 1px 8px 0px rgba(0,0,0,0.12);
transition: 100ms ease-out;
cursor: pointer;
}
input::-webkit-file-upload-button:hover {
background-color: #9e8160;
box-shadow: 0px 3px 5px -1px rgba(0,0,0,0.2), 0px 5px 8px 0px rgba(0,0,0,0.14), 0px 1px 14px 0px rgba(0,0,0,0.12)
}
\ No newline at end of file
...@@ -12,7 +12,7 @@ import lombok.Data; ...@@ -12,7 +12,7 @@ import lombok.Data;
@Data @Data
@Entity @Entity
@Table(name = "app_user", catalog = "shrasthra") @Table(name = "mcq_words", catalog = "shrasthra")
public class McqWord { public class McqWord {
@Id @Id
......
...@@ -14,6 +14,7 @@ public class SignMap { ...@@ -14,6 +14,7 @@ public class SignMap {
private Integer id; private Integer id;
private String label; private String label;
private String value; private String value;
private String imgUrl;
@Id @Id
@GeneratedValue(strategy = IDENTITY) @GeneratedValue(strategy = IDENTITY)
...@@ -40,6 +41,15 @@ public class SignMap { ...@@ -40,6 +41,15 @@ public class SignMap {
public void setValue(String value) { public void setValue(String value) {
this.value = value; this.value = value;
} }
@Column(name = "img_url")
public String getImgUrl() {
return imgUrl;
}
public void setImgUrl(String imgUrl) {
this.imgUrl = imgUrl;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment