Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -33,7 +33,8 @@ WHISPER_SIZE = os.getenv("WHISPER_SIZE", "small")
|
|
| 33 |
whisper_model = WhisperModel(WHISPER_SIZE, device="cpu", compute_type="int8")
|
| 34 |
|
| 35 |
# Summarizer: compact & solid
|
| 36 |
-
summarizer = pipeline("summarization", model="
|
|
|
|
| 37 |
|
| 38 |
# Title generator (tiny T5). You can switch to flan-t5-base if you upgrade hardware.
|
| 39 |
title_gen = pipeline("text2text-generation", model="google/flan-t5-small")
|
|
@@ -81,9 +82,10 @@ def summarize_and_title(transcript: str) -> Tuple[str, str]:
|
|
| 81 |
|
| 82 |
# Title
|
| 83 |
title_prompt = (
|
| 84 |
-
|
| 85 |
-
|
| 86 |
)
|
|
|
|
| 87 |
title = title_gen(title_prompt, max_new_tokens=16, num_return_sequences=1)[0]["generated_text"].strip()
|
| 88 |
|
| 89 |
# Tidying
|
|
|
|
| 33 |
whisper_model = WhisperModel(WHISPER_SIZE, device="cpu", compute_type="int8")
|
| 34 |
|
| 35 |
# Summarizer: compact & solid
|
| 36 |
+
summarizer = pipeline("summarization", model="philschmid/bart-large-cnn-samsum")
|
| 37 |
+
|
| 38 |
|
| 39 |
# Title generator (tiny T5). You can switch to flan-t5-base if you upgrade hardware.
|
| 40 |
title_gen = pipeline("text2text-generation", model="google/flan-t5-small")
|
|
|
|
| 82 |
|
| 83 |
# Title
|
| 84 |
title_prompt = (
|
| 85 |
+
"Write a short, catchy YouTube-style title (<= 8 words) for this summary:\n"
|
| 86 |
+
f"{summary}"
|
| 87 |
)
|
| 88 |
+
|
| 89 |
title = title_gen(title_prompt, max_new_tokens=16, num_return_sequences=1)[0]["generated_text"].strip()
|
| 90 |
|
| 91 |
# Tidying
|