Skip to content
Snippets Groups Projects
Commit 1ed77b87 authored by h4-rahman's avatar h4-rahman
Browse files

Merge branch 'hamid' into 'main'

Removing of exposed ports for tensorflow container

See merge request !34
parents 5e774724 b9a877e4
No related branches found
No related tags found
1 merge request!34Removing of exposed ports for tensorflow container
...@@ -41,8 +41,6 @@ services: ...@@ -41,8 +41,6 @@ services:
tensorflow_serving: tensorflow_serving:
image: tensorflow/serving image: tensorflow/serving
ports:
- "8501:8501"
volumes: volumes:
- ./models:/models - ./models:/models
environment: environment:
......
...@@ -262,6 +262,17 @@ def generate_pdf(request): ...@@ -262,6 +262,17 @@ def generate_pdf(request):
# Running the audio file through the model # Running the audio file through the model
class InstrumentDetectionView(APIView): class InstrumentDetectionView(APIView):
def post(self, request): def post(self, request):
# Get the user's token count
user_token_count = UserTokenCount.objects.get(user=request.user)
# Check if the user has more than one token
if user_token_count.token_count < 1:
return Response({'error': 'Insufficient tokens'}, status=status.HTTP_403_FORBIDDEN)
# Decrease the user's token count by one
user_token_count.token_count -= 1
user_token_count.save()
serializer = InstrumentDetectionSerializer(data=request.data) serializer = InstrumentDetectionSerializer(data=request.data)
if serializer.is_valid(): if serializer.is_valid():
audio_file = serializer.validated_data['audio_file'] audio_file = serializer.validated_data['audio_file']
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment