Skip to content

Commit 2e840af

Browse files
committed
first commit
0 parents  commit 2e840af

185 files changed

Lines changed: 4772 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/deploy.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Deploy to GitHub Pages
2+
on:
3+
push:
4+
branches: [ master ]
5+
workflow_dispatch:
6+
7+
permissions:
8+
contents: read
9+
pages: write
10+
id-token: write
11+
12+
jobs:
13+
deploy:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: '18'
23+
cache: 'npm'
24+
cache-dependency-path: './frontend/package-lock.json'
25+
26+
- name: Install dependencies
27+
run: |
28+
cd frontend
29+
npm ci
30+
31+
- name: Build
32+
run: |
33+
cd frontend
34+
npm run build
35+
36+
- name: Setup Pages
37+
uses: actions/configure-pages@v4
38+
39+
- name: Upload artifact
40+
uses: actions/upload-pages-artifact@v3
41+
with:
42+
path: './frontend/dist'
43+
44+
- name: Deploy to GitHub Pages
45+
id: deployment
46+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Node modules
2+
frontend/node_modules/
3+
4+
# Build outputs (uncomment based on your tool)
5+
frontend/dist/
6+
frontend/build/
7+
frontend/.next/
8+
frontend/out/
9+
10+
# Logs
11+
backend/*.log
12+
*.log
13+
npm-debug.log*
14+
yarn-debug.log*
15+
pnpm-debug.log*
16+
17+
# Environment variables
18+
backend/.env
19+
20+
# System files
21+
.DS_Store
22+
Thumbs.db
23+
24+
# IDE/editor folders
25+
.vscode/
26+
.idea/

README.md

Lines changed: 62 additions & 0 deletions

backend/transcription.py

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
import os
2+
import logging
3+
from flask import Flask, request, jsonify
4+
from flask_cors import CORS
5+
from openai import OpenAI
6+
from dotenv import load_dotenv
7+
8+
# Configure logging
9+
logging.basicConfig(
10+
level=logging.INFO,
11+
format="%(asctime)s - %(levelname)s - %(message)s",
12+
handlers=[logging.StreamHandler()],
13+
)
14+
15+
# Initialize Flask app
16+
app = Flask(__name__)
17+
CORS(app, resources={r"/*": {"origins": "*"}})
18+
19+
# Load environment variables
20+
load_dotenv()
21+
22+
# Initialize OpenAI client
23+
api_key = os.getenv("OPENAI_API_KEY")
24+
client = OpenAI(api_key=api_key)
25+
26+
27+
def text_to_isl_gloss(text):
28+
"""Convert English text to ISL gloss notation"""
29+
if not text.strip():
30+
return ""
31+
32+
try:
33+
response = client.chat.completions.create(
34+
model="gpt-3.5-turbo",
35+
messages=[
36+
{
37+
"role": "system",
38+
"content": """
39+
You are an expert ISL gloss translator. Follow these rules:
40+
1. Use UPPERCASE for signs
41+
2. Fingerspell names with hyphens (e.g., J-O-H-N)
42+
3. Omit English words like 'is', 'the', 'a'
43+
4. Use classifiers for spatial relationships
44+
5. Maintain ISL grammar structure (time-topic-comment)
45+
46+
Example Translations:
47+
English: "Hello, my name is John."
48+
ISL Gloss: "HELLO, ME NAME J-O-H-N."
49+
50+
English: "I have two cats at home."
51+
ISL Gloss: "HOME, TWO CAT HAVE-ME."
52+
53+
English: "Where is the nearest restaurant?"
54+
ISL Gloss: "NEAREST RESTAURANT WHERE?"
55+
56+
write only the translated ISL gloss without any additional words
57+
""",
58+
},
59+
{"role": "user", "content": f"Translate to ISL gloss: '{text}'"},
60+
],
61+
temperature=0.2,
62+
max_tokens=150,
63+
)
64+
return response.choices[0].message.content.strip()
65+
except Exception as e:
66+
logging.error(f"Translation error: {e}")
67+
return "Translation error"
68+
69+
70+
@app.route("/translate", methods=["POST"])
71+
def translate():
72+
data = request.get_json()
73+
text = data.get("text", "")
74+
75+
if not text:
76+
return jsonify({"error": "No text provided"}), 400
77+
78+
isl_gloss = text_to_isl_gloss(text)
79+
return jsonify({"isl": isl_gloss})
80+
81+
82+
@app.route("/health", methods=["GET"])
83+
def health_check():
84+
return jsonify({"status": "healthy", "service": "ISL Translator"})
85+
86+
87+
if __name__ == "__main__":
88+
app.run(host="0.0.0.0", port=5000, debug=True)
89.2 KB
Binary file not shown.
91.8 KB
Binary file not shown.
102 KB
Binary file not shown.
96.8 KB
Binary file not shown.
99.1 KB
Binary file not shown.
99.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)