Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -43,8 +43,8 @@ def process_with_fallback(func, *args, **kwargs):
|
|
43 |
raise
|
44 |
|
45 |
@spaces.GPU(duration=60)
|
46 |
-
def transcribe_audio(audio_file, translate, model_size
|
47 |
-
logger.info(f"Starting transcription: translate={translate}, model_size={model_size}
|
48 |
try:
|
49 |
result = process_with_fallback(process_audio, audio_file, translate=translate, model_size=model_size) # use_diarization=use_diarization
|
50 |
logger.info("Transcription completed successfully")
|
@@ -67,10 +67,10 @@ def summarize_text(text):
|
|
67 |
return "Error occurred during summarization. Please try again."
|
68 |
|
69 |
@spaces.GPU(duration=60)
|
70 |
-
def process_and_summarize(audio_file, translate, model_size,
|
71 |
-
logger.info(f"Starting process_and_summarize: translate={translate}, model_size={model_size},
|
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:
|
@@ -117,7 +117,7 @@ with gr.Blocks() as iface:
|
|
117 |
|
118 |
process_button.click(
|
119 |
process_and_summarize,
|
120 |
-
inputs=[audio_input, translate_checkbox, model_dropdown,
|
121 |
outputs=[transcription_output, summary_output]
|
122 |
)
|
123 |
|
|
|
43 |
raise
|
44 |
|
45 |
@spaces.GPU(duration=60)
|
46 |
+
def transcribe_audio(audio_file, translate, model_size):
|
47 |
+
logger.info(f"Starting transcription: translate={translate}, model_size={model_size}")
|
48 |
try:
|
49 |
result = process_with_fallback(process_audio, audio_file, translate=translate, model_size=model_size) # use_diarization=use_diarization
|
50 |
logger.info("Transcription completed successfully")
|
|
|
67 |
return "Error occurred during summarization. Please try again."
|
68 |
|
69 |
@spaces.GPU(duration=60)
|
70 |
+
def process_and_summarize(audio_file, translate, model_size, do_summarize=True):
|
71 |
+
logger.info(f"Starting process_and_summarize: translate={translate}, model_size={model_size}, do_summarize={do_summarize}")
|
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:
|
|
|
117 |
|
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 |
|