From 24f6d7a4dfc7a049c863c3f2fca4c9ebb479a723 Mon Sep 17 00:00:00 2001 From: Sir Blob <76974209+GamerBoss101@users.noreply.github.com> Date: Sat, 25 Jan 2025 11:12:43 -0500 Subject: [PATCH] small fix with bugs --- src/app/(web)/page.tsx | 10 ++++ src/app/{ => (web)}/transcribe/layout.tsx | 0 src/app/(web)/transcribe/page.tsx | 56 +++++++++++++++++++++++ src/app/page.tsx | 17 ------- src/app/transcribe/page.tsx | 56 ----------------------- 5 files changed, 66 insertions(+), 73 deletions(-) rename src/app/{ => (web)}/transcribe/layout.tsx (100%) create mode 100644 src/app/(web)/transcribe/page.tsx delete mode 100644 src/app/page.tsx delete mode 100644 src/app/transcribe/page.tsx diff --git a/src/app/(web)/page.tsx b/src/app/(web)/page.tsx index 93a2dc7..a5e7fb6 100644 --- a/src/app/(web)/page.tsx +++ b/src/app/(web)/page.tsx @@ -2,10 +2,20 @@ import { Hero } from "@/components/hero"; +import SignupPage from './signup/page' +import Link from "next/link"; + export default function Home() { return (
+
+

Welcome to Hoya

+ + + + +
); } diff --git a/src/app/transcribe/layout.tsx b/src/app/(web)/transcribe/layout.tsx similarity index 100% rename from src/app/transcribe/layout.tsx rename to src/app/(web)/transcribe/layout.tsx diff --git a/src/app/(web)/transcribe/page.tsx b/src/app/(web)/transcribe/page.tsx new file mode 100644 index 0000000..76fe1e9 --- /dev/null +++ b/src/app/(web)/transcribe/page.tsx @@ -0,0 +1,56 @@ +"use client"; + +import React, { useState } from "react"; +import axios from "axios"; + +const AudioTranscriber: React.FC = () => { + const [file, setFile] = useState(null); + const [transcription, setTranscription] = useState(null); + const [loading, setLoading] = useState(false); + + const handleFileChange = (event: React.ChangeEvent) => { + if (event.target.files && event.target.files.length > 0) { + setFile(event.target.files[0]); + } + }; + + const handleTranscription = async () => { + if (!file) return alert("Please select an audio file to transcribe!"); + + const formData = new FormData(); + formData.append("file", file); + + setLoading(true); + try { + const response = await axios.post("http://localhost:8000/transcribe", formData, { + headers: { + "Content-Type": "multipart/form-data", + }, + }); + setTranscription(response.data.transcription); + } catch (error) { + console.error("Error transcribing audio:", error); + alert("Failed to transcribe audio. Please try again."); + } finally { + setLoading(false); + } + }; + + return ( +
+

Audio Transcription

+ + + {transcription && ( +
+

Transcription:

+

{transcription}

+
+ )} +
+ ); +}; + +export default AudioTranscriber; diff --git a/src/app/page.tsx b/src/app/page.tsx deleted file mode 100644 index 29439a8..0000000 --- a/src/app/page.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import RootLayout from './layout' -import SignupPage from './signup/page' -import Link from "next/link"; - -export default function Home() { - return ( - -
-

Welcome to Hoya

- - - - -
-
- ) -} diff --git a/src/app/transcribe/page.tsx b/src/app/transcribe/page.tsx deleted file mode 100644 index 8ff8e61..0000000 --- a/src/app/transcribe/page.tsx +++ /dev/null @@ -1,56 +0,0 @@ -"use client"; - -import React, { useState } from "react"; -import axios from "axios"; - -const AudioTranscriber: React.FC = () => { - const [file, setFile] = useState(null); - const [transcription, setTranscription] = useState(null); - const [loading, setLoading] = useState(false); - - const handleFileChange = (event: React.ChangeEvent) => { - if (event.target.files && event.target.files.length > 0) { - setFile(event.target.files[0]); - } - }; - - const handleTranscription = async () => { - if (!file) return alert("Please select an audio file to transcribe!"); - - const formData = new FormData(); - formData.append("file", file); - - setLoading(true); - try { - const response = await axios.post("http://localhost:8000/transcribe", formData, { - headers: { - "Content-Type": "multipart/form-data", - }, - }); - setTranscription(response.data.transcription); - } catch (error) { - console.error("Error transcribing audio:", error); - alert("Failed to transcribe audio. Please try again."); - } finally { - setLoading(false); - } - }; - - return ( -
-

Audio Transcription

- - - {transcription && ( -
-

Transcription:

-

{transcription}

-
- )} -
- ); -}; - -export default AudioTranscriber;