camparchimedes commited on
Commit
102fb89
·
verified ·
1 Parent(s): 613108f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -6
app.py CHANGED
@@ -98,11 +98,11 @@ def transcribe(microphone, file_upload):
98
 
99
  # --system info string
100
  system_info = f"""
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
 
@@ -124,7 +124,18 @@ def save_to_pdf(text, summary):
124
  return pdf_output_path
125
 
126
 
127
- iface = gr.Blocks()
 
 
 
 
 
 
 
 
 
 
 
128
 
129
  with iface:
130
 
@@ -145,12 +156,12 @@ with iface:
145
 
146
  with gr.Row():
147
  with gr.Column(scale=3):
148
- text_output = gr.Textbox(label="Transkribert Tekst")
149
- system_info = gr.Textbox(label="System Info")
150
 
151
  with gr.Tabs():
152
  with gr.TabItem("Download PDF"):
153
- pdf_text_only = gr.Button("Last ned pdf med transkribert tekst")
154
  pdf_output = gr.File(label="/.docx?")
155
 
156
  pdf_text_only.click(fn=lambda text: save_to_pdf(text, ""), inputs=[text_output], outputs=[pdf_output])
 
98
 
99
  # --system info string
100
  system_info = f"""
 
101
  *Processing time: {output_time:.2f} seconds.*
102
  *Number of words: {word_count}*
103
  """
104
+ # *Memory: {memory.total / (1024 * 1024 * 1024):.2f}GB, used: {memory.percent}%, available: {memory.available / (1024 * 1024 * 1024):.2f}GB.*
105
+ # *GPU Utilization: {gpu_utilization}%, GPU Memory: {gpu_memory}*
106
  # *CPU Usage: {cpu_usage}%*
107
  return text, system_info
108
 
 
124
  return pdf_output_path
125
 
126
 
127
+ css = """
128
+ #transcription_output textarea {
129
+ background-color: #e0ffe0; /* light green */
130
+ color: black; /* text color */
131
+ }
132
+
133
+ #system_info_box textarea {
134
+ background-color: #ffe0b3; /* light orange */
135
+ color: black; /* text color */
136
+ }
137
+ """
138
+ iface = gr.Blocks(css=css)
139
 
140
  with iface:
141
 
 
156
 
157
  with gr.Row():
158
  with gr.Column(scale=3):
159
+ text_output = gr.Textbox(label="Transkribert Tekst", elem_id="transcription_output")
160
+ system_info = gr.Textbox(label="Antall sekunder, ord:", elem_id="system_info_box")
161
 
162
  with gr.Tabs():
163
  with gr.TabItem("Download PDF"):
164
+ pdf_text_only = gr.Button("Last ned pdf med resultat")
165
  pdf_output = gr.File(label="/.docx?")
166
 
167
  pdf_text_only.click(fn=lambda text: save_to_pdf(text, ""), inputs=[text_output], outputs=[pdf_output])