Skip to content

Commit

Permalink
1.1 base code
Browse files Browse the repository at this point in the history
  • Loading branch information
TarunSingh2002 committed Aug 25, 2024
1 parent 38ca5d3 commit 21eec4c
Show file tree
Hide file tree
Showing 14 changed files with 821 additions and 5,952 deletions.
4 changes: 4 additions & 0 deletions .dvc/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[core]
remote = myremote
['remote "myremote"']
url = gdrive://1VdeltffAXhu7LeIJgHGVCvtRAeKOUI3P
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
env
.env
/model
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
FROM public.ecr.aws/lambda/python:3.9
WORKDIR ${LAMBDA_TASK_ROOT}
COPY requirements.txt .
RUN pip install -r requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
COPY app.py ./
COPY data/raw/data.csv ./data/raw/
COPY models/similarity.pkl ./models/
COPY .env ./
COPY model/ ./model/
COPY templates/ ./templates/
CMD ["app.handler"]
12 changes: 12 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import awsgi
import pandas as pd
from dotenv import load_dotenv
from googletrans import Translator
from googleapiclient.discovery import build
from flask import Flask, render_template, request, render_template_string

Expand Down Expand Up @@ -89,5 +90,16 @@ def index():

return render_template('index.html')

def detect_and_translate(text):
translator = Translator()

detection = translator.detect(text)

if detection.lang != 'en':
translation = translator.translate(text, dest='en')
return translation.text
else:
return text

if __name__ == "__main__":
app.run(debug=True)
2 changes: 2 additions & 0 deletions evaluation_results.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Loss: 0.23659615218639374
Accuracy: 0.921999990940094
Loading

0 comments on commit 21eec4c

Please sign in to comment.