Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -101,10 +101,9 @@ def transcribe(microphone, file_upload):
|
|
101 |
*Memory: {memory.total / (1024 * 1024 * 1024):.2f}GB, used: {memory.percent}%, available: {memory.available / (1024 * 1024 * 1024):.2f}GB.*
|
102 |
*Processing time: {output_time:.2f} seconds.*
|
103 |
*Number of words: {word_count}*
|
104 |
-
*GPU Utilization: {gpu_utilization}%, GPU Memory: {gpu_memory}*
|
105 |
-
*CPU Usage: {cpu_usage}%*
|
106 |
"""
|
107 |
-
|
|
|
108 |
return text, system_info
|
109 |
|
110 |
def save_to_pdf(text, summary):
|
@@ -115,7 +114,7 @@ def save_to_pdf(text, summary):
|
|
115 |
# ----add same if/elif logic as above here----
|
116 |
#
|
117 |
if text:
|
118 |
-
pdf.multi_cell(0, 10, "
|
119 |
|
120 |
pdf.ln(10) # Paragraph metric
|
121 |
|
@@ -136,24 +135,24 @@ with iface:
|
|
136 |
|
137 |
with gr.Row():
|
138 |
gr.Markdown('''
|
139 |
-
#####
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
##### ''')
|
144 |
microphone = gr.Audio(sources="microphone", type="filepath")
|
145 |
upload = gr.Audio(sources="upload", type="filepath")
|
146 |
-
transcribe_btn = gr.Button("
|
147 |
|
148 |
-
with gr.Row():
|
149 |
-
text_output = gr.Textbox(label="Transkribert Tekst")
|
150 |
with gr.Column(scale=3):
|
151 |
-
|
|
|
152 |
|
153 |
with gr.Tabs():
|
154 |
with gr.TabItem("Download PDF"):
|
155 |
pdf_text_only = gr.Button("Last ned pdf med transkribert tekst")
|
156 |
-
pdf_output = gr.File(label="/.docx")
|
157 |
|
158 |
pdf_text_only.click(fn=lambda text: save_to_pdf(text, ""), inputs=[text_output], outputs=[pdf_output])
|
159 |
|
|
|
101 |
*Memory: {memory.total / (1024 * 1024 * 1024):.2f}GB, used: {memory.percent}%, available: {memory.available / (1024 * 1024 * 1024):.2f}GB.*
|
102 |
*Processing time: {output_time:.2f} seconds.*
|
103 |
*Number of words: {word_count}*
|
|
|
|
|
104 |
"""
|
105 |
+
#*GPU Utilization: {gpu_utilization}%, GPU Memory: {gpu_memory}*
|
106 |
+
# *CPU Usage: {cpu_usage}%*
|
107 |
return text, system_info
|
108 |
|
109 |
def save_to_pdf(text, summary):
|
|
|
114 |
# ----add same if/elif logic as above here----
|
115 |
#
|
116 |
if text:
|
117 |
+
pdf.multi_cell(0, 10, "Transkribert Tekst:\n" + text)
|
118 |
|
119 |
pdf.ln(10) # Paragraph metric
|
120 |
|
|
|
135 |
|
136 |
with gr.Row():
|
137 |
gr.Markdown('''
|
138 |
+
##### Last opp lydfila 🔊 (dropp ’drag-n-drop’)
|
139 |
+
##### Trykk på "Transkriber" knappen og vent på svar ☕️
|
140 |
+
##### Går rimelig bra kjapt med Norwegian NB-Whisper Large⚡️
|
141 |
+
##### Planlegger tilleggs-funksjoner senere😅
|
142 |
##### ''')
|
143 |
microphone = gr.Audio(sources="microphone", type="filepath")
|
144 |
upload = gr.Audio(sources="upload", type="filepath")
|
145 |
+
transcribe_btn = gr.Button("Transkriber")
|
146 |
|
147 |
+
with gr.Row():
|
|
|
148 |
with gr.Column(scale=3):
|
149 |
+
text_output = gr.Textbox(label="Transkribert Tekst")
|
150 |
+
system_info = gr.Textbox(label="System Info")
|
151 |
|
152 |
with gr.Tabs():
|
153 |
with gr.TabItem("Download PDF"):
|
154 |
pdf_text_only = gr.Button("Last ned pdf med transkribert tekst")
|
155 |
+
pdf_output = gr.File(label="/.docx?")
|
156 |
|
157 |
pdf_text_only.click(fn=lambda text: save_to_pdf(text, ""), inputs=[text_output], outputs=[pdf_output])
|
158 |
|