Skip to content

Commit

Permalink
Changes for Usage Analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
Shanks0465 committed Sep 17, 2024
1 parent e172928 commit 4231cd6
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
3 changes: 3 additions & 0 deletions frontend/components/Feedback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export default function Feedback({
sourceLanguage,
targetLanguage,
domain,
track,
}: {
serviceId: string;
task: string;
Expand All @@ -82,6 +83,7 @@ export default function Feedback({
sourceLanguage: string;
targetLanguage: string;
domain: string;
track: boolean;
}) {
const { isOpen, onOpen, onClose } = useDisclosure();

Expand Down Expand Up @@ -160,6 +162,7 @@ export default function Feedback({
sourceLanguage: sourceLanguage,
targetLanguage: targetLanguage,
domain: domain,
track: track,
});
if (feedbackSubmitted) {
toast({
Expand Down
14 changes: 14 additions & 0 deletions frontend/components/TryOut/ASR.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
useToast,
VStack,
CircularProgress,
Switch,
} from "@chakra-ui/react";
import axios from "axios";
import { ChangeEventHandler, useRef, useState } from "react";
Expand Down Expand Up @@ -104,6 +105,7 @@ export default function ASR({ services }: { services: any }) {

const [success, setSuccess] = useState(false);
const [isLoading, setIsLoading] = useState(false);
const [tracking, setTracking] = useState(false);

const toast = useToast();

Expand Down Expand Up @@ -132,6 +134,7 @@ export default function ASR({ services }: { services: any }) {
samplingRate: samplingRate,
preProcessors: preProcessor,
postProcessors: postProcessor,
track: tracking,
});
setIsLoading(false);
if (response.status === 200) {
Expand Down Expand Up @@ -231,6 +234,7 @@ export default function ASR({ services }: { services: any }) {
samplingRate: samplingRate,
preProcessors: preProcessor,
postProcessors: postProcessor,
track: tracking,
});
setIsLoading(false);
if (response.status === 200) {
Expand Down Expand Up @@ -316,6 +320,7 @@ export default function ASR({ services }: { services: any }) {
)
)}
</Select>

{service !== "ai4bharat/conformer-multilingual-all--gpu-t4" ? (
<>
<FormLabel textColor={"gray.500"}>
Expand Down Expand Up @@ -381,6 +386,14 @@ export default function ASR({ services }: { services: any }) {
<FormHelperText>
Please Choose a domain for your audio. (For evaluation purposes)
</FormHelperText>
<FormLabel textColor={"gray.500"}>
Allow the AI to be improved by usage analysis.
</FormLabel>
<Switch
checked={tracking}
onChange={(e) => setTracking(e.target.checked)}
colorScheme="orange"
/>
</VStack>
<VStack p={5} w={"full"}>
<HStack>
Expand All @@ -404,6 +417,7 @@ export default function ASR({ services }: { services: any }) {
sourceLanguage={sourceLanguage}
targetLanguage={""}
domain={domain}
track={tracking}
/>
) : (
<>
Expand Down
14 changes: 14 additions & 0 deletions frontend/components/TryOut/NMT.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ const fetchTranslation = async ({
input,
task,
serviceId,
track,
}: {
sourceLanguage: string;
targetLanguage: string;
input: string;
task: string;
serviceId: string;
track: boolean;
}) => {
try {
const response = await axios.post(`${API_URL}/inference/translate`, {
Expand All @@ -38,6 +40,7 @@ const fetchTranslation = async ({
input: input,
task: task,
serviceId: serviceId,
track: track,
});
return response;
} catch (error: any) {
Expand All @@ -62,6 +65,7 @@ export default function NMT({ services }: { services: any }) {
const [outputText, setOutputText] = useState("");
const [success, setSuccess] = useState(false);
const [isLoading, setIsLoading] = useState(false);
const [tracking, setTracking] = useState(false);

const toast = useToast();

Expand Down Expand Up @@ -141,6 +145,14 @@ export default function NMT({ services }: { services: any }) {
onChange={() => setTransliteration(!transliteration)}
colorScheme={"orange"}
></Switch>
<FormLabel textColor={"gray.500"}>
Allow the AI to be improved by usage analysis.
</FormLabel>
<Switch
checked={tracking}
onChange={(e) => setTracking(e.target.checked)}
colorScheme="orange"
/>
</VStack>
</VStack>
<VStack w={"full"}>
Expand Down Expand Up @@ -176,6 +188,7 @@ export default function NMT({ services }: { services: any }) {
input: inputText,
task: "translation",
serviceId: service,
track: tracking,
});
setIsLoading(false);
if (response.status === 200) {
Expand Down Expand Up @@ -240,6 +253,7 @@ export default function NMT({ services }: { services: any }) {
sourceLanguage={sourceLanguage}
targetLanguage={targetLanguage}
domain="general"
track={tracking}
/>
) : (
<>
Expand Down
14 changes: 14 additions & 0 deletions frontend/components/TryOut/TTS.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ const fetchAudio = async ({
gender,
samplingRate,
serviceId,
track,
}: {
sourceLanguage: string;
input: string;
gender: string;
samplingRate: number;
serviceId: string;
track: boolean;
}) => {
try {
const response = await axios.post(`${API_URL}/inference/convert`, {
Expand All @@ -43,6 +45,7 @@ const fetchAudio = async ({
serviceId: serviceId,
samplingRate: samplingRate,
gender: gender,
track: track,
});
return response;
} catch (error: any) {
Expand All @@ -66,6 +69,7 @@ export default function TTS({ services }: { services: any }) {
const [inputText, setInputText] = useState("");
const [output, setOutput] = useState("");
const [isLoading, setIsLoading] = useState(false);
const [tracking, setTracking] = useState(false);

const [success, setSuccess] = useState(false);

Expand Down Expand Up @@ -129,6 +133,14 @@ export default function TTS({ services }: { services: any }) {
onChange={() => setTransliteration(!transliteration)}
colorScheme={"orange"}
></Switch>
<FormLabel textColor={"gray.500"}>
Allow the AI to be improved by usage analysis.
</FormLabel>
<Switch
checked={tracking}
onChange={(e) => setTracking(e.target.checked)}
colorScheme="orange"
/>
</VStack>
</HStack>
</VStack>
Expand Down Expand Up @@ -180,6 +192,7 @@ export default function TTS({ services }: { services: any }) {
gender: gender,
samplingRate: samplingRate,
serviceId: service,
track: tracking,
});
setIsLoading(false);
if (response.status === 200) {
Expand Down Expand Up @@ -248,6 +261,7 @@ export default function TTS({ services }: { services: any }) {
sourceLanguage={sourceLanguage}
targetLanguage=""
domain="general"
track={tracking}
/>
) : (
<>
Expand Down

0 comments on commit 4231cd6

Please sign in to comment.