Spaces:
Running
Running
oceansweep
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -2554,24 +2554,24 @@ def chunk_transcript(transcript: str, chunk_duration: int, words_per_second) ->
|
|
2554 |
return chunks
|
2555 |
|
2556 |
|
2557 |
-
def summarize_chunks(api_name: str, api_key: str, transcript: List[dict], chunk_duration: int,
|
2558 |
-
words_per_second: int) -> str:
|
2559 |
-
if api_name not in summarizers: # See 'summarizers' dict in the main script
|
2560 |
-
return f"Unsupported API: {api_name}"
|
2561 |
-
|
2562 |
-
summarizer = summarizers[api_name]
|
2563 |
-
text = extract_text_from_segments(transcript)
|
2564 |
-
chunks = chunk_transcript(text, chunk_duration, words_per_second)
|
2565 |
-
|
2566 |
-
summaries = []
|
2567 |
-
for chunk in chunks:
|
2568 |
-
if api_name == 'openai':
|
2569 |
-
# Ensure the correct model and prompt are passed
|
2570 |
-
summaries.append(summarizer(api_key, chunk, custom_prompt))
|
2571 |
-
|
2572 |
-
summaries.append(summarizer(api_key, chunk))
|
2573 |
-
|
2574 |
-
return "\n\n".join(summaries)
|
2575 |
|
2576 |
|
2577 |
################## ####################
|
|
|
2554 |
return chunks
|
2555 |
|
2556 |
|
2557 |
+
#def summarize_chunks(api_name: str, api_key: str, transcript: List[dict], chunk_duration: int,
|
2558 |
+
# words_per_second: int) -> str:
|
2559 |
+
# if api_name not in summarizers: # See 'summarizers' dict in the main script
|
2560 |
+
# return f"Unsupported API: {api_name}"
|
2561 |
+
|
2562 |
+
# summarizer = summarizers[api_name]
|
2563 |
+
# text = extract_text_from_segments(transcript)
|
2564 |
+
# chunks = chunk_transcript(text, chunk_duration, words_per_second)
|
2565 |
+
|
2566 |
+
# summaries = []
|
2567 |
+
# for chunk in chunks:
|
2568 |
+
# if api_name == 'openai':
|
2569 |
+
# # Ensure the correct model and prompt are passed
|
2570 |
+
## summaries.append(summarizer(api_key, chunk, custom_prompt))
|
2571 |
+
# else:
|
2572 |
+
# summaries.append(summarizer(api_key, chunk))
|
2573 |
+
#
|
2574 |
+
# return "\n\n".join(summaries)
|
2575 |
|
2576 |
|
2577 |
################## ####################
|