Skip to content

Commit

Permalink
Merge pull request #179 from AI4Bharat/xlit01
Browse files Browse the repository at this point in the history
use anudesh backend as a proxy api for transliteration
  • Loading branch information
aparna-aa authored Nov 20, 2024
2 parents f6d7637 + f2e8e35 commit 6b66ae8
Show file tree
Hide file tree
Showing 12 changed files with 4,669 additions and 3,562 deletions.
7,616 changes: 4,067 additions & 3,549 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"deploy": "gh-pages -d build"
},
"dependencies": {
"@ai4bharat/indic-transliterate": "^1.3.2",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@material-ui/core": "^4.12.4",
Expand Down Expand Up @@ -60,7 +59,8 @@
"react-speech-recognition": "^3.10.0",
"react-syntax-highlighter": "^15.5.0",
"recharts": "^2.12.0",
"regenerator-runtime": "^0.14.1"
"regenerator-runtime": "^0.14.1",
"textarea-caret": "^3.1.0"
},
"devDependencies": {
"autoprefixer": "^10.4.16",
Expand Down
7 changes: 6 additions & 1 deletion src/app/ui/pages/chat/AddGlossary.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ import CustomizedSnackbars from "@/components/common/Snackbar";
import {
IndicTransliterate,
getTransliterationLanguages,
} from "@ai4bharat/indic-transliterate";
} from "@/libs/dist";
import "../../../../IndicTransliterate/index.css";
import { MenuProps } from "@/utils/utils";
import { fetchGetAddGlossary, setDomain } from "@/Lib/Features/actions/AddGlossary";
import { fetchDomain } from "@/Lib/Features/actions/getDomain";
import configs from "@/config/config";

const AddGlossary = ({
openDialog,
Expand Down Expand Up @@ -281,6 +282,8 @@ const AddGlossary = ({

{ Sourcedata.length > 0 && selectedSourceLang !== "en" ? (
<IndicTransliterate
customApiURL={`${configs.BASE_URL_AUTO}/tasks/xlit-api/generic/transliteration/`}
apiKey={`JWT ${localStorage.getItem('anudesh_access_token')}`}
lang={Sourcelanguage.LangCode ? Sourcelanguage.LangCode : (Sourcedata.length > 0 ? Sourcedata[0]?.LangCode : "hi" )}
value={SourceText}
onChangeText={(SourceText) => {
Expand All @@ -297,6 +300,8 @@ const AddGlossary = ({
/>)}
{ data.length > 0 && selectedTargetLang !== "en" ? (
<IndicTransliterate
customApiURL={`${configs.BASE_URL_AUTO}/tasks/xlit-api/generic/transliteration/`}
apiKey={`JWT ${localStorage.getItem('anudesh_access_token')}`}
lang={Targetlanguage.LangCode ? Targetlanguage.LangCode : (data.length > 0 ? data[0]?.LangCode : "hi")}
value={targetText}
onChangeText={(targetText) => {
Expand Down
10 changes: 5 additions & 5 deletions src/app/ui/pages/chat/SuggestAnEdit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ import { setDomain } from "@/Lib/Features/actions/AddGlossary";
import CustomizedSnackbars from "@/components/common/Snackbar";
import SuggestAnEditAPI from "../../../actions/api/Annotate/SuggestAnEditAPI";
import { MenuProps } from "@/utils/utils";
import {
IndicTransliterate,
getTransliterationLanguages,
} from "@ai4bharat/indic-transliterate";
import "@ai4bharat/indic-transliterate/dist/index.css";
import { IndicTransliterate, getTransliterationLanguages } from "@/libs/dist";
import configs from "@/config/config";
// import "@ai4bharat/indic-transliterate/dist/index.css";

const SuggestAnEdit = ({
openDialog,
Expand Down Expand Up @@ -150,6 +148,8 @@ const SuggestAnEdit = ({

{ targetData.length > 0 && targetlang !== "en" ? (
<IndicTransliterate
customApiURL={`${configs.BASE_URL_AUTO}/tasks/xlit-api/generic/transliteration/`}
apiKey={`JWT ${localStorage.getItem('anudesh_access_token')}`}
lang={Targetlanguage.LangCode ? Targetlanguage.LangCode : (targetData.length > 0 ? targetData[0]?.LangCode : "en" )}
value={targetText}
onChangeText={(targetText) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React, { useState } from "react";
import classNames from "classnames";
import { Box, FormControlLabel, Typography } from "@mui/material";
import { IndicTransliterate } from "@ai4bharat/indic-transliterate";
import { IndicTransliterate } from "@/libs/dist";

import "./styles.css";
import { CheckBox } from "@mui/icons-material";
import configs from "@/config/config";

const orange = {
200: "pink",
Expand Down Expand Up @@ -350,6 +351,8 @@ const OutputSelection = () => {
<Box className="feedback-section">
{globalTransliteration ? (
<IndicTransliterate
customApiURL={`${configs.BASE_URL_AUTO}/tasks/xlit-api/generic/transliteration/`}
apiKey={`JWT ${localStorage.getItem('anudesh_access_token')}`}
renderComponent={(props) => (
<textarea
sx={{
Expand Down
5 changes: 4 additions & 1 deletion src/components/Chat/TextArea.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import IconButton from "@mui/material/IconButton";
import SendRoundedIcon from "@mui/icons-material/SendRounded";
import CircularProgress from "@mui/material/CircularProgress";
import { TextareaAutosize as BaseTextareaAutosize } from "@mui/base/TextareaAutosize";
import { IndicTransliterate } from "@ai4bharat/indic-transliterate";
import { IndicTransliterate } from "@/libs/dist";
import { TextareaAutosize } from "@material-ui/core";
import configs from "@/config/config";

const orange = {
200: "pink",
Expand Down Expand Up @@ -160,6 +161,8 @@ export default function Textarea({
>
{globalTransliteration ? (
<IndicTransliterate
customApiURL={`${configs.BASE_URL_AUTO}/tasks/xlit-api/generic/transliteration/`}
apiKey={`JWT ${localStorage.getItem('anudesh_access_token')}`}
renderComponent={(props) => (
<textarea
xs={size}
Expand Down
5 changes: 4 additions & 1 deletion src/components/Transliteration/Transliteration.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import React, { useEffect, useState ,useRef} from "react";
import { TextField } from "@mui/material";
import { Autocomplete, Box, Button, Card, Grid, Typography } from "@mui/material";
import { IndicTransliterate, getTransliterationLanguages } from "@ai4bharat/indic-transliterate";
import { IndicTransliterate, getTransliterationLanguages } from "@/libs/dist";
import "../../IndicTransliterate/index.css"
import GlobalStyles from "@/styles/LayoutStyles";
import CustomizedSnackbars from "../common/Snackbar";
import useMediaQuery from '@mui/material/useMediaQuery';
import { useSelector } from "react-redux";
import { useParams } from "react-router-dom";
import configs from "@/config/config";
/* eslint-disable react-hooks/exhaustive-deps */

const Transliteration = (props) => {
Expand Down Expand Up @@ -123,6 +124,8 @@ const Transliteration = (props) => {
</Grid>

<IndicTransliterate
customApiURL={`${configs.BASE_URL_AUTO}/tasks/xlit-api/generic/transliteration/`}
apiKey={`JWT ${localStorage.getItem('anudesh_access_token')}`}
lang={selectedLang.LangCode ? selectedLang.LangCode : (data.length > 0 && (params.taskId || params.id) ? data[0]?.LangCode : "hi")}
value={text}
onChangeText={(val) => {
Expand Down
6 changes: 4 additions & 2 deletions src/components/common/Search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import themeDefault from '../../themes/theme'
import "../../styles/Dataset.css";
import { useDispatch, useSelector } from "react-redux";
import { setSearchProjectCard } from "@/Lib/Features/searchProjectCard";
import { IndicTransliterate } from "@ai4bharat/indic-transliterate";

import { IndicTransliterate } from "@/libs/dist";
import configs from "@/config/config";

const Search = (props) => {
const ref = useRef(null);
Expand Down Expand Up @@ -52,6 +52,8 @@ const Search = (props) => {
</Grid>
{globalTransliteration=="true" ?
<IndicTransliterate
customApiURL={`${configs.BASE_URL_AUTO}/tasks/xlit-api/generic/transliteration/`}
apiKey={`JWT ${localStorage.getItem('anudesh_access_token')}`}
renderComponent={(props) => (
<textarea

Expand Down
Loading

0 comments on commit 6b66ae8

Please sign in to comment.