File size: 462 Bytes
4464026
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from typing import Union
from fastapi import FastAPI
from src.utils_youtube import get_youtube_transcript

## create a new FASTAPI app instance
app=FastAPI()


@app.get("/")
def home():
    return {"message":"Hello World"}

# Define a function to handle the GET request at `/generate`
@app.get("/generate/")
def generate(youtubeurl,src_lang,target_lang):
    transript=get_youtube_transcript(youtubeurl,src_lang,target_lang)
    return {"output":f"{transript}"}