Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -72,7 +72,7 @@ def process_and_summarize(audio_file, translate, model_size, do_summarize=True):
|
|
72 |
try:
|
73 |
language_segments, final_segments = transcribe_audio(audio_file, translate, model_size)
|
74 |
|
75 |
-
transcription = "Detected language changes:\n\n"
|
76 |
for segment in language_segments:
|
77 |
transcription += f"Language: {segment['language']}\n"
|
78 |
transcription += f"Time: {segment['start']:.2f}s - {segment['end']:.2f}s\n\n"
|
@@ -91,7 +91,7 @@ def process_and_summarize(audio_file, translate, model_size, do_summarize=True):
|
|
91 |
|
92 |
summary = summarize_text(full_text) if do_summarize else ""
|
93 |
logger.info("Process and summarize completed successfully")
|
94 |
-
return transcription, summary
|
95 |
except Exception as e:
|
96 |
logger.error(f"Process and summarize failed: {str(e)}")
|
97 |
logger.error(traceback.format_exc())
|
@@ -108,7 +108,9 @@ with gr.Blocks() as iface:
|
|
108 |
model_dropdown = gr.Dropdown(choices=["tiny", "base", "small", "medium", "large", "large-v2", "large-v3"], label="Whisper Model Size", value="small")
|
109 |
process_button = gr.Button("Process Audio")
|
110 |
transcription_output = gr.Textbox(label="Transcription/Translation")
|
|
|
111 |
summary_output = gr.Textbox(label="Summary")
|
|
|
112 |
|
113 |
def update_summarize_checkbox(translate):
|
114 |
return gr.Checkbox(interactive=translate)
|
@@ -118,7 +120,7 @@ with gr.Blocks() as iface:
|
|
118 |
process_button.click(
|
119 |
process_and_summarize,
|
120 |
inputs=[audio_input, translate_checkbox, model_dropdown, summarize_checkbox],
|
121 |
-
outputs=[transcription_output, summary_output]
|
122 |
)
|
123 |
|
124 |
gr.Markdown(
|
|
|
72 |
try:
|
73 |
language_segments, final_segments = transcribe_audio(audio_file, translate, model_size)
|
74 |
|
75 |
+
# transcription = "Detected language changes:\n\n"
|
76 |
for segment in language_segments:
|
77 |
transcription += f"Language: {segment['language']}\n"
|
78 |
transcription += f"Time: {segment['start']:.2f}s - {segment['end']:.2f}s\n\n"
|
|
|
91 |
|
92 |
summary = summarize_text(full_text) if do_summarize else ""
|
93 |
logger.info("Process and summarize completed successfully")
|
94 |
+
return transcription, full_text, summary
|
95 |
except Exception as e:
|
96 |
logger.error(f"Process and summarize failed: {str(e)}")
|
97 |
logger.error(traceback.format_exc())
|
|
|
108 |
model_dropdown = gr.Dropdown(choices=["tiny", "base", "small", "medium", "large", "large-v2", "large-v3"], label="Whisper Model Size", value="small")
|
109 |
process_button = gr.Button("Process Audio")
|
110 |
transcription_output = gr.Textbox(label="Transcription/Translation")
|
111 |
+
full_text_output = gr.Textbox(label="Transcription/Translation")
|
112 |
summary_output = gr.Textbox(label="Summary")
|
113 |
+
|
114 |
|
115 |
def update_summarize_checkbox(translate):
|
116 |
return gr.Checkbox(interactive=translate)
|
|
|
120 |
process_button.click(
|
121 |
process_and_summarize,
|
122 |
inputs=[audio_input, translate_checkbox, model_dropdown, summarize_checkbox],
|
123 |
+
outputs=[transcription_output, full_text_output, summary_output]
|
124 |
)
|
125 |
|
126 |
gr.Markdown(
|