Update app.py
Browse files
app.py
CHANGED
|
@@ -74,13 +74,17 @@ def run_on_cpu(func):
|
|
| 74 |
|
| 75 |
@run_on_cpu
|
| 76 |
def process_input(audio_file=None):
|
|
|
|
| 77 |
for partial_message in process_audio(audio_file):
|
| 78 |
-
|
|
|
|
| 79 |
|
| 80 |
@run_on_cpu
|
| 81 |
def process_transcribe_input(audio_file=None):
|
|
|
|
| 82 |
for partial_message in process_audio(audio_file, transcript=True):
|
| 83 |
-
|
|
|
|
| 84 |
|
| 85 |
class StopOnTokens(StoppingCriteria):
|
| 86 |
def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor, **kwargs) -> bool:
|
|
@@ -142,9 +146,9 @@ examples.extend(good_examples)
|
|
| 142 |
examples.extend(bad_examples)
|
| 143 |
|
| 144 |
with gr.Blocks() as iface:
|
| 145 |
-
gr.Markdown("# Llama3.
|
| 146 |
gr.Markdown("Enter text to convert to audio, then submit the audio to generate text or Upload Audio")
|
| 147 |
-
gr.Markdown("
|
| 148 |
|
| 149 |
with gr.Row():
|
| 150 |
input_type = gr.Radio(["text", "audio"], label="Input Type", value="audio")
|
|
|
|
| 74 |
|
| 75 |
@run_on_cpu
|
| 76 |
def process_input(audio_file=None):
|
| 77 |
+
full_message = ""
|
| 78 |
for partial_message in process_audio(audio_file):
|
| 79 |
+
full_message = partial_message # Always use the latest partial message
|
| 80 |
+
return full_message
|
| 81 |
|
| 82 |
@run_on_cpu
|
| 83 |
def process_transcribe_input(audio_file=None):
|
| 84 |
+
full_message = ""
|
| 85 |
for partial_message in process_audio(audio_file, transcript=True):
|
| 86 |
+
full_message = partial_message # Always use the latest partial message
|
| 87 |
+
return full_message
|
| 88 |
|
| 89 |
class StopOnTokens(StoppingCriteria):
|
| 90 |
def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor, **kwargs) -> bool:
|
|
|
|
| 146 |
examples.extend(bad_examples)
|
| 147 |
|
| 148 |
with gr.Blocks() as iface:
|
| 149 |
+
gr.Markdown("# Llama3.2s Mini: checkpoint September 26, 2024")
|
| 150 |
gr.Markdown("Enter text to convert to audio, then submit the audio to generate text or Upload Audio")
|
| 151 |
+
gr.Markdown("Inspired by [Homebrew Ltd](https://homebrew.ltd/) | [Read our blog post](https://homebrew.ltd/blog/llama3-just-got-ears)")
|
| 152 |
|
| 153 |
with gr.Row():
|
| 154 |
input_type = gr.Radio(["text", "audio"], label="Input Type", value="audio")
|