Skip to content

Commit

Permalink
And its back to working.
Browse files Browse the repository at this point in the history
Ok. So, rolling summary works with chatGPT via CLI.
Passing in a list works via CLI.
Summarization of said list works via CLI.
Demo GUI works.
Dark/Light mode toggle does not work.
Simple/Advanced mode toggle does not work.
Detail slider in the GUI does not work.
No current option for rolling summarization in the GUI.
Lack of 're-summarize/ask a question about the transcription' box in the GUI.
  • Loading branch information
rmusser01 committed May 16, 2024
1 parent 3147fde commit c82fac1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 238 deletions.
227 changes: 0 additions & 227 deletions Long_Summarize_openai.py

This file was deleted.

21 changes: 10 additions & 11 deletions summarize.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,23 +318,20 @@ def read_paths_from_file(file_path):
""" Reads a file containing URLs or local file paths and returns them as a list. """
paths = [] # Initialize paths as an empty list
with open(file_path, 'r') as file:
for line in file:
line = line.strip()
if line and not os.path.exists(
os.path.join('results', normalize_title(line.split('/')[-1].split('.')[0]) + '.json')):
logging.debug("line successfully imported from file and added to list to be transcribed")
paths.append(line)
paths = [line.strip() for line in file]
return paths


def process_path(path):
""" Decides whether the path is a URL or a local file and processes accordingly. """
if path.startswith('http'):
logging.debug("file is a URL")
return get_youtube(path) # For YouTube URLs, modify to download and extract info
# For YouTube URLs, modify to download and extract info
return get_youtube(path)
elif os.path.exists(path):
logging.debug("File is a path")
return process_local_file(path) # For local files, define a function to handle them
# For local files, define a function to handle them
return process_local_file(path)
else:
logging.error(f"Path does not exist: {path}")
return None
Expand Down Expand Up @@ -1668,7 +1665,7 @@ def main(input_path, api_name=None, api_key=None, num_speakers=2, whisper_model=
# except requests.exceptions.ConnectionError:
# requests.status_code = "Connection: "
# Perform summarization based on the specified API
elif api_name and api_key:
elif api_name:
logging.debug(f"MAIN: Summarization being performed by {api_name}")
json_file_path = audio_file.replace('.wav', '.segments.json')
if api_name.lower() == 'openai':
Expand Down Expand Up @@ -1758,7 +1755,7 @@ def main(input_path, api_name=None, api_key=None, num_speakers=2, whisper_model=
#end_time = time.monotonic()
# print("Total program execution time: " + timedelta(seconds=end_time - start_time))

return results
return results


if __name__ == "__main__":
Expand Down Expand Up @@ -1793,6 +1790,7 @@ def main(input_path, api_name=None, api_key=None, num_speakers=2, whisper_model=
logging.basicConfig(level=getattr(logging, log_level), format='%(asctime)s - %(levelname)s - %(message)s')

custom_prompt = args.custom_prompt

if custom_prompt == "":
logging.debug(f"Custom prompt defined, will use \n\nf{custom_prompt} \n\nas the prompt")
print(f"Custom Prompt has been defined. Custom prompt: \n\n {args.custom_prompt}")
Expand All @@ -1808,7 +1806,6 @@ def main(input_path, api_name=None, api_key=None, num_speakers=2, whisper_model=
print("No custom prompt defined, will use default")

if args.user_interface:

launch_ui(demo_mode=False)
else:
if not args.input_path:
Expand All @@ -1835,6 +1832,8 @@ def main(input_path, api_name=None, api_key=None, num_speakers=2, whisper_model=
# Get all API keys from the config
api_keys = {key: value for key, value in config.items('API') if key.endswith('_api_key')}

api_name = args.api_name

# Rolling Summarization will only be performed if an API is specified and the API key is available
# and the rolling summarization flag is set
#
Expand Down

0 comments on commit c82fac1

Please sign in to comment.