skyvera commited on
Commit
1773c97
·
verified ·
1 Parent(s): fb05459

Upload 18 files

Browse files
app.py CHANGED
@@ -1,12 +1,14 @@
1
  import gradio as gr
 
2
  from cs_ai_kt_transcribe_share.kt_transcript import KnowledgeTranscriber
3
 
4
  def process_inputs(api_key, drive_folder_link):
 
5
  try:
6
  # Assuming drive_link is the folder_path and transcribe_flag is derived or fixed
7
  folder_path = drive_folder_link # Example adjustment, actual implementation may vary
8
  transcribe_flag = True # Example, adjust based on actual use case
9
- kt = KnowledgeTranscriber(api_key) # Create an instance of KnowledgeTranscriber
10
  kt.process_folder('scripts/ktTranscript/cs_ai_kt_transcribe_share/Input-Folder', True, drive_folder_link) # Call the method
11
  return "Success"
12
  except ValueError as e:
 
1
  import gradio as gr
2
+ import os
3
  from cs_ai_kt_transcribe_share.kt_transcript import KnowledgeTranscriber
4
 
5
  def process_inputs(api_key, drive_folder_link):
6
+ os.environ['OPENAI_API_KEY'] = api_key # Set the API_KEY environment variable
7
  try:
8
  # Assuming drive_link is the folder_path and transcribe_flag is derived or fixed
9
  folder_path = drive_folder_link # Example adjustment, actual implementation may vary
10
  transcribe_flag = True # Example, adjust based on actual use case
11
+ kt = KnowledgeTranscriber(os.environ['OPENAI_API_KEY']) # Create an instance of KnowledgeTranscriber
12
  kt.process_folder('scripts/ktTranscript/cs_ai_kt_transcribe_share/Input-Folder', True, drive_folder_link) # Call the method
13
  return "Success"
14
  except ValueError as e:
cs_ai_kt_transcribe_share/.DS_Store CHANGED
Binary files a/cs_ai_kt_transcribe_share/.DS_Store and b/cs_ai_kt_transcribe_share/.DS_Store differ
 
cs_ai_kt_transcribe_share/__pycache__/kt_transcript.cpython-312.pyc CHANGED
Binary files a/cs_ai_kt_transcribe_share/__pycache__/kt_transcript.cpython-312.pyc and b/cs_ai_kt_transcribe_share/__pycache__/kt_transcript.cpython-312.pyc differ
 
cs_ai_kt_transcribe_share/kt_transcript.py CHANGED
@@ -759,6 +759,10 @@ class KnowledgeTranscriber(object):
759
  try:
760
  # Ensure the directory where the file will be saved exists
761
  os.makedirs(os.path.dirname(file_path), exist_ok=True)
 
 
 
 
762
 
763
  request = service.files().get_media(fileId=file_id)
764
  with open(file_path, 'wb') as fh:
 
759
  try:
760
  # Ensure the directory where the file will be saved exists
761
  os.makedirs(os.path.dirname(file_path), exist_ok=True)
762
+ # Check if the file is an mp4 file before downloading
763
+ if not file_path.endswith('.mp4'):
764
+ logging.info(f"Skipping non-mp4 file: {file_path}")
765
+ return
766
 
767
  request = service.files().get_media(fileId=file_id)
768
  with open(file_path, 'wb') as fh: