Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -51,44 +51,54 @@ def getSummary(article):
|
|
| 51 |
return b
|
| 52 |
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
|
| 94 |
demo.launch(debug=True)
|
|
|
|
| 51 |
return b
|
| 52 |
|
| 53 |
|
| 54 |
+
|
| 55 |
+
gr.HTML(
|
| 56 |
+
"""
|
| 57 |
+
<div style="text-align: center; max-width: 500px; margin: 0 auto;">
|
| 58 |
+
<div>
|
| 59 |
+
<h1>Dutch whisperer</h1>
|
| 60 |
+
</div>
|
| 61 |
+
<p style="margin-bottom: 10px; font-size: 94%">
|
| 62 |
+
Summarize audio files, mic input or Youtube videos using OpenAI's Whisper
|
| 63 |
+
</p>
|
| 64 |
+
</div>
|
| 65 |
+
"""
|
| 66 |
+
)
|
| 67 |
+
with gr.Tab('Get a summary from your own mic or audio file'):
|
| 68 |
+
input_text_url = gr.Textbox(placeholder='Youtube video URL', label='URL')
|
| 69 |
+
result_button_transcribe = gr.Button('1. Transcribe')
|
| 70 |
+
output_text_transcribe = gr.Textbox(placeholder='Transcript of the YouTube video.', label='Transcript')
|
| 71 |
+
|
| 72 |
+
result_button_summary = gr.Button('2. Create Summary')
|
| 73 |
+
output_text_summary = gr.Textbox(placeholder='Summary of the YouTube video transcript.', label='Summary')
|
| 74 |
+
|
| 75 |
+
result_button_transcribe.click(getText, inputs=input_text_url, outputs=output_text_transcribe)
|
| 76 |
+
result_button_summary.click(getSummary, inputs=output_text_transcribe, outputs=output_text_summary)
|
| 77 |
+
|
| 78 |
+
gr.Interface(
|
| 79 |
+
fn=transcribe,
|
| 80 |
+
inputs=[
|
| 81 |
+
gr.inputs.Audio(source="microphone", type="filepath", optional=True),
|
| 82 |
+
gr.inputs.Audio(source="upload", type="filepath", optional=True),
|
| 83 |
+
],
|
| 84 |
+
outputs="text",
|
| 85 |
+
layout="horizontal",
|
| 86 |
+
theme="huggingface",
|
| 87 |
+
title="Dutch whisper: Summarize Audio",
|
| 88 |
+
description=(
|
| 89 |
+
"Transcribe and summarize."
|
| 90 |
+
),
|
| 91 |
+
allow_flagging="never",
|
| 92 |
+
)
|
| 93 |
+
with gr.Tab('Summary of Youtube video'):
|
| 94 |
+
input_text_url = gr.Textbox(placeholder='Youtube video URL', label='URL')
|
| 95 |
+
result_button_transcribe = gr.Button('1. Transcribe')
|
| 96 |
+
output_text_transcribe = gr.Textbox(placeholder='Transcript of the YouTube video.', label='Transcript')
|
| 97 |
+
|
| 98 |
+
result_button_summary = gr.Button('2. Create Summary')
|
| 99 |
+
output_text_summary = gr.Textbox(placeholder='Summary of the YouTube video transcript.', label='Summary')
|
| 100 |
+
|
| 101 |
+
result_button_transcribe.click(getText, inputs=input_text_url, outputs=output_text_transcribe)
|
| 102 |
+
result_button_summary.click(getSummary, inputs=output_text_transcribe, outputs=output_text_summary)
|
| 103 |
|
| 104 |
demo.launch(debug=True)
|