-
Notifications
You must be signed in to change notification settings - Fork 829
feat: Add LingoLens App for Community Sprint #1922
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
Open
trivedikavya
wants to merge
20
commits into
lingodotdev:main
Choose a base branch
from
trivedikavya:lingolens
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+21,853
β0
Open
Changes from 12 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
656be1f
Lingo-lens
trivedikavya cd1080d
Unwanted Folder Created
trivedikavya 1697add
Advance Features Added
trivedikavya 4e04cc2
test: verification
trivedikavya 9dfae27
Testing
trivedikavya 1f77b53
Going to re add Lingo-lens
trivedikavya e7a074a
Lingo-lens
trivedikavya 9b3cdc4
feat: add changeset for LingoLens
trivedikavya 97a4019
Merge branch 'lingodotdev:main' into community/lingo-lenss
trivedikavya e081d97
coderabbit feedback
trivedikavya 1a7af03
Env Variable changed
trivedikavya 555fe25
Merge branch 'lingodotdev:main' into lingolens
trivedikavya 005bb9f
Merge branch 'main' into lingolens
sumitsaurabh927 7c9b04e
Merge branch 'lingodotdev:main' into lingolens
trivedikavya 5f3c571
fix(community/lingo-lens): resolve PR feedback and add changeset
trivedikavya f835d0a
fix(community/lingo-lens): resolve PR feedback and add changeset
trivedikavya dc3d3d8
fix(community/lingo-lens): resolve PR feedback and add changeset
trivedikavya fc4b2d0
fix(community/lingo-lens): address reviewer feedback on README and upβ¦
trivedikavya bd14e2f
fix(community/lingo-lens): address reviewer feedback on README and upβ¦
trivedikavya 5010ca9
fix(community/lingo-lens): address reviewer feedback on README
trivedikavya File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| --- | ||
|
|
||
| # Community Submission: LingoLens | ||
|
|
||
| Added a new community project in `community/Lingo-lens`. | ||
| - **Showcase:** AI Visual Translator combining Tesseract OCR with Lingo.dev's AI Language Inference. | ||
| - **Features:** Intelligent Script Detection, Real-time Localization, and a stunning Glassmorphism UI. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # Logs | ||
| logs | ||
| *.log | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
| pnpm-debug.log* | ||
| lerna-debug.log* | ||
|
|
||
| node_modules | ||
| dist | ||
| dist-ssr | ||
| *.local | ||
|
|
||
| # Editor directories and files | ||
| .vscode/* | ||
| !.vscode/extensions.json | ||
| .idea | ||
| .DS_Store | ||
| *.suo | ||
| *.ntvs* | ||
| *.njsproj | ||
| *.sln | ||
| *.sw? | ||
| .env |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| # LingoLens πΈ | ||
|
|
||
| **LingoLens** is a powerful **AI Visual Translator** built for the **Lingo.dev Community Sprint**. | ||
|
|
||
| It upgrades standard OCR with **Intelligent Script Detection** and **Lingo.dev's AI Language Inference**. Wrapped in a stunning **Glassmorphism UI**, it allows users to upload images of text (receipts, signs, documents) and automatically detects the language script and translation context in real-time. | ||
|
|
||
| ## π₯ Demo & Testing | ||
| We have provided resources to help you test the application quickly: | ||
|
|
||
| ### 1. Watch the Demo | ||
| > **[Click here to watch the Demo Video on YouTube πΊ](https://youtu.be/UK_GkEOumnI)** | ||
|
|
||
| ### 2. Test with Sample Data | ||
| I have included a sample receipt image in this repository for you to test with: | ||
| * **File:** [`test.png`](./test.png) | ||
| * **Usage:** Drag and drop this image into the app to see the Auto-Detection and Translation in action immediately. | ||
|
|
||
| ## π Lingo.dev Features Highlighted | ||
| This project demonstrates key capabilities of the Lingo.dev ecosystem: | ||
| 1. **AI Language Inference:** Uses the `sourceLocale: null` feature of the **Lingo.dev SDK** to automatically identify the source language from the text context. | ||
| 2. **Smart Script Detection:** Implements **Tesseract OSD** (Orientation & Script Detection) to dynamically load the correct OCR alphabet (e.g., Japanese vs. Latin) before reading. | ||
| 3. **Real-time Localization:** Uses `lingo.localizeText` to provide accurate, context-aware translations for dynamic user content. | ||
| 4. **Secure Backend Proxy:** Implements a robust Node.js/Express bridge (`server.js`) to handle API authentication securely. | ||
|
|
||
| ## π οΈ Setup Instructions | ||
|
|
||
| ### Prerequisites | ||
| * Node.js (v18 or higher) | ||
| * A Lingo.dev API Key | ||
|
|
||
| ## π οΈ Setup Instructions | ||
|
|
||
| ### Prerequisites | ||
| * Node.js (v18 or higher) | ||
| * A Lingo.dev API Key | ||
|
|
||
| ### 1. Installation | ||
| Navigate to the project directory and install dependencies: | ||
| ```bash | ||
| cd community/lingo-lens | ||
| npm install | ||
| ``` | ||
|
|
||
| ### 2. Configuration | ||
| Create a .env file in the root of the lingo-lens directory and add your API key: | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ```bash | ||
| VITE_LINGO_API_KEY=lin_your_actual_api_key_here | ||
| ``` | ||
|
|
||
| ## 3. Running the App | ||
|
|
||
| This application requires **both the backend server** (to communicate with Lingo.dev) and the **frontend client** (React) to run simultaneously. | ||
|
|
||
| --- | ||
|
|
||
| ### Terminal 1 β Backend Server | ||
|
|
||
| ```bash | ||
| node server.js | ||
| ``` | ||
|
|
||
| You should see: `β Proxy Server running on http://localhost:3001` | ||
|
|
||
|
|
||
| ### Terminal 2 β Frontend Client | ||
|
|
||
| ```bash | ||
| npm run dev | ||
| ``` | ||
|
|
||
| Open the URL shown in the terminal: `(usually: http://localhost:5173)` | ||
|
|
||
| ## π How It Works | ||
|
|
||
| 1. **Upload & Detect** User uploads an image. The app first runs **Tesseract OSD** to detect the script (e.g., "Han" for Chinese, "Latin" for English). | ||
|
|
||
| 2. **Extract (OCR)** Based on the script, the app loads the optimized OCR model (e.g., `chi_sim` or `eng`) and extracts the raw text from the image. | ||
|
|
||
| 3. **Inference** The frontend sends the text to the server with `sourceLang: 'auto'`. | ||
|
|
||
| 4. **Translate** The **Lingo.dev SDK** analyzes the text content, infers the source language, and generates a context-aware translation. | ||
|
|
||
| 5. **Result** The original text and the translation appear instantly on the animated Glassmorphism interface. | ||
|
|
||
|
|
||
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import js from '@eslint/js' | ||
| import globals from 'globals' | ||
| import reactHooks from 'eslint-plugin-react-hooks' | ||
| import reactRefresh from 'eslint-plugin-react-refresh' | ||
| import { defineConfig, globalIgnores } from 'eslint/config' | ||
|
|
||
| export default defineConfig([ | ||
| globalIgnores(['dist']), | ||
| { | ||
| files: ['**/*.{js,jsx}'], | ||
| extends: [ | ||
| js.configs.recommended, | ||
| reactHooks.configs.flat.recommended, | ||
| reactRefresh.configs.vite, | ||
| ], | ||
| languageOptions: { | ||
| ecmaVersion: 2020, | ||
| globals: globals.browser, | ||
| parserOptions: { | ||
| ecmaVersion: 'latest', | ||
| ecmaFeatures: { jsx: true }, | ||
| sourceType: 'module', | ||
| }, | ||
| }, | ||
| rules: { | ||
| 'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }], | ||
| }, | ||
| }, | ||
| ]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title>lingo-lens</title> | ||
| </head> | ||
| <body> | ||
| <div id="root"></div> | ||
| <script type="module" src="/src/main.jsx"></script> | ||
| </body> | ||
| </html> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.