Skip to content

Commit

Permalink
Update server.py
Browse files Browse the repository at this point in the history
  • Loading branch information
kurianbenoy authored Sep 2, 2024
1 parent 0ff2383 commit d2f7b4d
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions api/server.py
Original file line number Diff line number Diff line change
@@ -2,13 +2,13 @@
import tempfile
import logging
from typing import Dict
from modal import Image, Stub, web_endpoint
from modal import Image, App, web_endpoint
from fastapi.responses import StreamingResponse
import json

# Define the GPU type to be used for processing
# Refer - https://modal.com/docs/guide/gpu
GPU_TYPE = "H100"
GPU_TYPE = "T4"
SAMPLING_RATE = 16000
# Moved to large-v2 as felt large-v3 is hallucinating more
MODEL_SIZE = "large-v2"
@@ -162,11 +162,11 @@ def process_audio(b64):
.run_function(download_models, gpu=GPU_TYPE)
)

# Initialize the processing stub with the defined Docker image
stub = Stub(name="seamless_m4t_speech", image=image)
# Initialize the processing app with the defined Docker image
app = App(name="seamless_m4t_speech", image=image)


@stub.function(gpu=GPU_TYPE, timeout=SIXTY_MINS)
@app.function(gpu=GPU_TYPE, timeout=SIXTY_MINS)
@web_endpoint(method="POST")
def generate_seamlessm4t_speech(item: Dict):
"""
@@ -285,7 +285,7 @@ def sliding_window_approch_timestamps(speech_timestamps_seconds):
return new_group_chunks # Return the list of new grouped chunks


@stub.function(gpu=GPU_TYPE, timeout=SIXTY_MINS)
@app.function(gpu=GPU_TYPE, timeout=SIXTY_MINS)
@web_endpoint(method="POST")
def generate_faster_whisper_speech(item: Dict):
"""
@@ -388,7 +388,7 @@ def generate():
return {"message": "Internal server error", "code": 500}


@stub.function(gpu=GPU_TYPE, timeout=SIXTY_MINS)
@app.function(gpu=GPU_TYPE, timeout=SIXTY_MINS)
@web_endpoint(method="POST")
def generate_vegam_faster_whisper(item: Dict):
import os
@@ -483,7 +483,7 @@ def generate():
return {"message": "Internal server error", "code": 500}


@stub.function(gpu=GPU_TYPE, timeout=SIXTY_MINS)
@app.function(gpu=GPU_TYPE, timeout=SIXTY_MINS)
@web_endpoint(method="POST")
def generate_whisperx_speech(item: Dict):
"""
@@ -590,7 +590,7 @@ async def generate():
return {"message": "Internal server error", "code": 500}


@stub.function(gpu=GPU_TYPE, timeout=SIXTY_MINS)
@app.function(gpu=GPU_TYPE, timeout=SIXTY_MINS)
@web_endpoint(method="POST")
def youtube_generate_seamlessm4t_speech(item: Dict):
"""
@@ -724,7 +724,7 @@ def generate():
return {"message": "Internal server error", "code": 500}


@stub.function(gpu=GPU_TYPE, timeout=SIXTY_MINS)
@app.function(gpu=GPU_TYPE, timeout=SIXTY_MINS)
@web_endpoint(method="POST")
def youtube_generate_faster_whisper_speech(item: Dict):
"""
@@ -839,7 +839,7 @@ def generate():
return {"message": "Internal server error", "code": 500}


@stub.function(gpu=GPU_TYPE, timeout=SIXTY_MINS)
@app.function(gpu=GPU_TYPE, timeout=SIXTY_MINS)
@web_endpoint(method="POST")
def youtube_generate_vegam_faster_whisper(item: Dict):
import os
@@ -946,7 +946,7 @@ def generate():
return {"message": "Internal server error", "code": 500}


@stub.function(gpu=GPU_TYPE, timeout=SIXTY_MINS)
@app.function(gpu=GPU_TYPE, timeout=SIXTY_MINS)
@web_endpoint(method="POST")
def youtube_generate_whisperx_speech(item: Dict):
"""

0 comments on commit d2f7b4d

Please sign in to comment.