WJ88 commited on
Commit
c1f7cc8
Β·
verified Β·
1 Parent(s): c93756b

Added README contents to Gradio UI

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -2,7 +2,7 @@
2
  Optimised NeMo Parakeet-TDT streaming demo for CPU-only Hugging Face Spaces
3
  """
4
 
5
- import os, time, threading, queue, logging
6
  import numpy as np
7
  import gradio as gr
8
  from scipy import signal
@@ -32,6 +32,7 @@ logger = logging.getLogger("asr_app")
32
  SR = 16_000 # Model sample-rate
33
  CHUNK_SECONDS = 4 # seconds per inference window
34
  CHUNK_SAMPLES = SR * CHUNK_SECONDS
 
35
 
36
  # ────────────────────────────────────────────────
37
  # ASR Application
@@ -133,6 +134,12 @@ class ASRApp:
133
  # ────────────────────────────────────────────────
134
  # Gradio UI
135
  # ────────────────────────────────────────────────
 
 
 
 
 
 
136
  asr_app = ASRApp()
137
  with gr.Blocks() as demo:
138
  mic = gr.Audio(
@@ -142,6 +149,8 @@ with gr.Blocks() as demo:
142
  label="Microphone",
143
  )
144
  out = gr.Textbox(label="Transcription")
 
 
145
  mic.stream(
146
  fn=asr_app.stream_fn,
147
  inputs=mic,
 
2
  Optimised NeMo Parakeet-TDT streaming demo for CPU-only Hugging Face Spaces
3
  """
4
 
5
+ import os, time, threading, queue, logging, re
6
  import numpy as np
7
  import gradio as gr
8
  from scipy import signal
 
32
  SR = 16_000 # Model sample-rate
33
  CHUNK_SECONDS = 4 # seconds per inference window
34
  CHUNK_SAMPLES = SR * CHUNK_SECONDS
35
+ README_CONTENT = ""
36
 
37
  # ────────────────────────────────────────────────
38
  # ASR Application
 
134
  # ────────────────────────────────────────────────
135
  # Gradio UI
136
  # ────────────────────────────────────────────────
137
+ with open('README.md', 'r', encoding='utf-8') as file:
138
+ README_CONTENT = file.read()
139
+
140
+ # Remove YAML frontmatter between the first pair of '---' lines
141
+ README_CONTENT_without_YAML = re.sub(r'^---.*?---\s*', '', README_CONTENT, flags=re.DOTALL)
142
+
143
  asr_app = ASRApp()
144
  with gr.Blocks() as demo:
145
  mic = gr.Audio(
 
149
  label="Microphone",
150
  )
151
  out = gr.Textbox(label="Transcription")
152
+ gr.Markdown(README_CONTENT_without_YAML)
153
+
154
  mic.stream(
155
  fn=asr_app.stream_fn,
156
  inputs=mic,