Illia56 commited on
Commit
94f1c39
1 Parent(s): a495c2a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py CHANGED
@@ -29,6 +29,21 @@ def summarize_video(youtube_url: str, task: str = "transcribe", return_timestamp
29
  })
30
 
31
  return summary_result
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
  MODEL_NAME = "openai/whisper-large-v2"
34
 
 
29
  })
30
 
31
  return summary_result
32
+
33
+ def transcribe_audio(youtube_url: str, task: str = "transcribe", return_timestamps: bool = False, api_name: str = "/predict_2") -> dict:
34
+ """
35
+ Transcribe audio from a given YouTube URL using a specified model.
36
+ Parameters:
37
+ - youtube_url (str): The YouTube URL to transcribe.
38
+ - task (str, optional): The task to perform. Default is "transcribe".
39
+ - return_timestamps (bool, optional): Whether to return timestamps. Default is True.
40
+ - api_name (str, optional): The API endpoint to use. Default is "/predict_2".
41
+ Returns:
42
+ - dict: The transcription result.
43
+ """
44
+ client = Client("https://sanchit-gandhi-whisper-jax.hf.space/")
45
+ result = client.predict(youtube_url, task, return_timestamps, fn_index=7)
46
+ return result
47
 
48
  MODEL_NAME = "openai/whisper-large-v2"
49