Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added New XLIT API #96

Merged
merged 3 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions frontend/components/TryOut/NMT.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
"use client";
import { API_URL, LANGUAGE_CODE_NAMES } from "@/app/config";
import { IndicTransliterate } from "@ai4bharat/indic-transliterate";
import {
IndicTransliterate,
IndicTransliterateProps,
} from "@ai4bharat/indic-transliterate";
import {
Button,
Card,
Expand Down Expand Up @@ -52,6 +55,13 @@ interface LanguageCodeNames {
[key: string]: string;
}

interface CustomIndicTransliterateProps extends IndicTransliterateProps {
customApiURL?: string;
}

const CustomIndicTransliterate =
IndicTransliterate as React.ComponentType<CustomIndicTransliterateProps>;

export default function NMT({ services }: { services: any }) {
const [service, setService] = useState(Object.keys(services)[0]);
const [sourceLanguage, setSourceLanguage] = useState(
Expand Down Expand Up @@ -156,7 +166,8 @@ export default function NMT({ services }: { services: any }) {
</VStack>
</VStack>
<VStack w={"full"}>
<IndicTransliterate
<CustomIndicTransliterate
customApiURL={"https://xlit-api1.ai4bharat.org/tl/"}
enabled={sourceLanguage !== "en" && transliteration}
renderComponent={(props) => <Textarea {...props} />}
value={inputText}
Expand Down
15 changes: 13 additions & 2 deletions frontend/components/TryOut/TTS.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ import {
import { LANGUAGE_CODE_NAMES } from "@/app/config";
import axios from "axios";
import { API_URL } from "@/app/config";
import { IndicTransliterate } from "@ai4bharat/indic-transliterate";
import {
IndicTransliterate,
IndicTransliterateProps,
} from "@ai4bharat/indic-transliterate";
import { useToast } from "@chakra-ui/react";
import Feedback from "../Feedback";

Expand Down Expand Up @@ -58,6 +61,13 @@ interface LanguageCodeNames {
[key: string]: string;
}

interface CustomIndicTransliterateProps extends IndicTransliterateProps {
customApiURL?: string;
}

const CustomIndicTransliterate =
IndicTransliterate as React.ComponentType<CustomIndicTransliterateProps>;

export default function TTS({ services }: { services: any }) {
const [service, setService] = useState(Object.keys(services)[0]);
const [sourceLanguage, setSourceLanguage] = useState(
Expand Down Expand Up @@ -171,7 +181,8 @@ export default function TTS({ services }: { services: any }) {
</VStack>
</VStack>
<VStack w={"full"}>
<IndicTransliterate
<CustomIndicTransliterate
customApiURL={"https://xlit-api1.ai4bharat.org/tl/"}
enabled={sourceLanguage !== "en" && transliteration}
renderComponent={(props) => <Textarea w={344} {...props} />}
value={inputText}
Expand Down
15 changes: 13 additions & 2 deletions frontend/components/TryOut/XLIT.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,24 @@ import {
useToast,
} from "@chakra-ui/react";
import { LANGUAGE_CODE_NAMES } from "@/app/config";
import { IndicTransliterate } from "@ai4bharat/indic-transliterate";
import {
IndicTransliterate,
IndicTransliterateProps,
} from "@ai4bharat/indic-transliterate";
import axios from "axios";
import { API_URL } from "@/app/config";

interface LanguageCodeNames {
[key: string]: string;
}

interface CustomIndicTransliterateProps extends IndicTransliterateProps {
customApiURL?: string;
}

const CustomIndicTransliterate =
IndicTransliterate as React.ComponentType<CustomIndicTransliterateProps>;

const fetchTransliteration = async ({
sourceLanguage,
targetLanguage,
Expand Down Expand Up @@ -127,7 +137,8 @@ export default function XLIT({ services }: { services: any }) {
</Select> */}
</VStack>
<VStack w={"full"}>
<IndicTransliterate
<CustomIndicTransliterate
customApiURL={"https://xlit-api1.ai4bharat.org/tl/"}
enabled={sourceLanguage !== "en"}
renderComponent={(props) => <Textarea {...props} />}
value={inputText}
Expand Down
Loading