AlexMo commited on
Commit
c5ef19b
1 Parent(s): 8464140

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +49 -39
app.py CHANGED
@@ -51,44 +51,54 @@ def getSummary(article):
51
  return b
52
 
53
 
54
- with gr.Blocks() as demo:
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
- gr.Interface(
69
- fn=transcribe,
70
- inputs=[
71
- gr.inputs.Audio(source="microphone", type="filepath", optional=True),
72
- gr.inputs.Audio(source="upload", type="filepath", optional=True),
73
- ],
74
- outputs="text",
75
- layout="horizontal",
76
- theme="huggingface",
77
- title="Dutch whisper: Summarize Audio",
78
- description=(
79
- "Transcribe and summarize."
80
- ),
81
- allow_flagging="never",
82
- )
83
- with gr.Tab('Summary of Youtube video'):
84
- input_text_url = gr.Textbox(placeholder='Youtube video URL', label='URL')
85
- result_button_transcribe = gr.Button('1. Transcribe')
86
- output_text_transcribe = gr.Textbox(placeholder='Transcript of the YouTube video.', label='Transcript')
87
-
88
- result_button_summary = gr.Button('2. Create Summary')
89
- output_text_summary = gr.Textbox(placeholder='Summary of the YouTube video transcript.', label='Summary')
90
-
91
- result_button_transcribe.click(getText, inputs=input_text_url, outputs=output_text_transcribe)
92
- result_button_summary.click(getSummary, inputs=output_text_transcribe, outputs=output_text_summary)
 
 
 
 
 
 
 
 
 
 
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)