diff --git a/backend/areas/models.py b/backend/areas/models.py index 8531bb1..12cdd46 100644 --- a/backend/areas/models.py +++ b/backend/areas/models.py @@ -42,6 +42,8 @@ class ModelFeedback(models.Model): modelResponse = models.TextField() liked = models.BooleanField(default=False) comment = models.TextField() + sourceLanguage = models.CharField(max_length=100,null=True,blank=True) + targetLanguage = models.CharField(max_length=100,null=True,blank=True) def __str__(self) -> str: return f"{self.id}_{self.serviceId}" @@ -132,7 +134,7 @@ class Publication(models.Model): id = models.AutoField(primary_key=True) title = models.CharField(max_length=200) dataset = models.ManyToManyField(Dataset,null=True,blank=True) - model = models.ManyToManyField(Model,null=True,blank=True) + model = models.ManyToManyField(Model,null=True,blank=True,) def __str__(self) -> str: return f"{self.title}" \ No newline at end of file diff --git a/backend/areas/serializers.py b/backend/areas/serializers.py index 9fb01a7..4161ae2 100644 --- a/backend/areas/serializers.py +++ b/backend/areas/serializers.py @@ -21,7 +21,7 @@ class Meta: class ModelFeedbackSerializer(ModelSerializer): class Meta: model = ModelFeedback - fields = ['id','serviceId','task','modelInput','modelResponse','comment','liked','postedOn'] + fields = ['id','serviceId','task','modelInput','modelResponse','comment','liked','postedOn','sourceLanguage','targetLanguage'] class ModelSerializer(ModelSerializer): class Meta: diff --git a/backend/areas/views.py b/backend/areas/views.py index 1dd5bf9..1c75279 100644 --- a/backend/areas/views.py +++ b/backend/areas/views.py @@ -74,7 +74,7 @@ def translate(request): -@ratelimit(key='ip', rate='50/m', method='POST') + @api_view(["POST"]) @permission_classes((permissions.AllowAny,)) def transcribe(request): @@ -198,6 +198,8 @@ class ModelFeedbackViewSet(viewsets.ModelViewSet): def create(self, request, *args, **kwargs): body = request.data task = body["task"] + sourceLanguage = body["sourceLanguage"] + targetLanguage = body["targetLanguage"] modelInput = body["modelInput"] modelResponse = body["modelResponse"] @@ -232,7 +234,7 @@ def create(self, request, *args, **kwargs): modelResponse = hashlib.sha256(modelResponse.encode()) modelResponse = modelResponse.hexdigest() - feedback = ModelFeedback(serviceId = body["serviceId"],task=task,modelInput=modelInput,modelResponse=modelResponse,liked=val2Bool(body["liked"]),comment=body["comment"]) + feedback = ModelFeedback(serviceId = body["serviceId"],task=task,modelInput=modelInput,modelResponse=modelResponse,liked=val2Bool(body["liked"]),comment=body["comment"],sourceLanguage=sourceLanguage,targetLanguage=targetLanguage) feedback.save() return Response({"message":"Submitted Feedback"},status=status.HTTP_201_CREATED) diff --git a/frontend/components/Feedback.tsx b/frontend/components/Feedback.tsx index 84c745d..a8006af 100644 --- a/frontend/components/Feedback.tsx +++ b/frontend/components/Feedback.tsx @@ -71,11 +71,15 @@ export default function Feedback({ task, modelInput, modelResponse, + sourceLanguage, + targetLanguage, }: { serviceId: string; task: string; modelInput: string; modelResponse: string; + sourceLanguage: string; + targetLanguage: string; }) { const { isOpen, onOpen, onClose } = useDisclosure(); @@ -151,6 +155,8 @@ export default function Feedback({ serviceId: serviceId, modelInput: modelInput, modelResponse: modelResponse, + sourceLanguage: sourceLanguage, + targetLanguage: targetLanguage, }); if (feedbackSubmitted) { toast({ diff --git a/frontend/components/TryOut/ASR.tsx b/frontend/components/TryOut/ASR.tsx index 0977080..e8643e4 100644 --- a/frontend/components/TryOut/ASR.tsx +++ b/frontend/components/TryOut/ASR.tsx @@ -374,6 +374,8 @@ export default function ASR({ services }: { services: any }) { task="asr" modelInput={audioString} modelResponse={outputText} + sourceLanguage={sourceLanguage} + targetLanguage={""} /> ) : ( <> diff --git a/frontend/components/TryOut/NMT.tsx b/frontend/components/TryOut/NMT.tsx index 01732a5..33d8428 100644 --- a/frontend/components/TryOut/NMT.tsx +++ b/frontend/components/TryOut/NMT.tsx @@ -230,6 +230,8 @@ export default function NMT({ services }: { services: any }) { task="translation" modelInput={inputText} modelResponse={outputText} + sourceLanguage={sourceLanguage} + targetLanguage={targetLanguage} /> ) : ( <> diff --git a/frontend/components/TryOut/TTS.tsx b/frontend/components/TryOut/TTS.tsx index 0facfe1..ac1fecd 100644 --- a/frontend/components/TryOut/TTS.tsx +++ b/frontend/components/TryOut/TTS.tsx @@ -240,6 +240,8 @@ export default function TTS({ services }: { services: any }) { task="tts" modelInput={inputText} modelResponse={output} + sourceLanguage={sourceLanguage} + targetLanguage="" /> ) : ( <>