eaglelandsonce commited on
Commit
2212eea
1 Parent(s): 204ee93
Files changed (1) hide show
  1. app.py +20 -22
app.py CHANGED
@@ -35,37 +35,35 @@ def get_summary_from_file(file):
35
  b = summarizer(article)
36
  return b[0]['summary_text']
37
 
 
 
 
 
 
 
 
 
 
 
38
  with gr.Blocks() as demo:
39
  gr.Markdown("<h1><center>Youtube video transcription with OpenAI's Whisper</center></h1>")
40
  gr.Markdown("<center>Enter the link of any youtube video or upload an MP4 file to get the transcription and a summary in text form.</center>")
41
 
42
- with gr.Tab('Get the transcription of any Youtube video'):
43
- with gr.Row():
44
- input_text_1 = gr.Textbox(placeholder='Enter the Youtube video URL', label='URL')
45
- output_text_1 = gr.Textbox(placeholder='Transcription of the video', label='Transcription')
46
- result_button_1 = gr.Button('Get Transcription from URL')
47
-
48
- with gr.Tab('Summary of Youtube video'):
49
  with gr.Row():
50
  input_text = gr.Textbox(placeholder='Enter the Youtube video URL', label='URL')
51
- output_text = gr.Textbox(placeholder='Summary text of the Youtube Video', label='Summary')
52
- result_button = gr.Button('Get Summary from URL')
 
53
 
54
- with gr.Tab('Upload MP4 for Transcription'):
55
  with gr.Row():
56
  input_file = gr.File(label='Upload MP4')
57
- output_text_file = gr.Textbox(placeholder='Transcription of the video', label='Transcription')
58
- result_button_file = gr.Button('Get Transcription from File')
59
-
60
- with gr.Tab('Summary from Uploaded MP4'):
61
- with gr.Row():
62
- input_file_summary = gr.File(label='Upload MP4')
63
- output_text_file_summary = gr.Textbox(placeholder='Summary text of the video', label='Summary')
64
- result_button_file_summary = gr.Button('Get Summary from File')
65
 
66
- result_button.click(get_summary_from_url, inputs=input_text, outputs=output_text)
67
- result_button_1.click(get_text_from_url, inputs=input_text_1, outputs=output_text_1)
68
- result_button_file.click(get_text_from_file, inputs=input_file, outputs=output_text_file)
69
- result_button_file_summary.click(get_summary_from_file, inputs=input_file_summary, outputs=output_text_file_summary)
70
 
71
  demo.launch(debug=True)
 
35
  b = summarizer(article)
36
  return b[0]['summary_text']
37
 
38
+ def process_url(url):
39
+ transcription = get_text_from_url(url)
40
+ summary = get_summary_from_url(url)
41
+ return summary, transcription
42
+
43
+ def process_file(file):
44
+ transcription = get_text_from_file(file)
45
+ summary = get_summary_from_file(file)
46
+ return summary, transcription
47
+
48
  with gr.Blocks() as demo:
49
  gr.Markdown("<h1><center>Youtube video transcription with OpenAI's Whisper</center></h1>")
50
  gr.Markdown("<center>Enter the link of any youtube video or upload an MP4 file to get the transcription and a summary in text form.</center>")
51
 
52
+ with gr.Tab('Youtube Video'):
 
 
 
 
 
 
53
  with gr.Row():
54
  input_text = gr.Textbox(placeholder='Enter the Youtube video URL', label='URL')
55
+ output_summary = gr.Textbox(placeholder='Summary text of the Youtube Video', label='Summary')
56
+ output_transcription = gr.Textbox(placeholder='Transcription of the video', label='Transcription')
57
+ result_button = gr.Button('Process Youtube Video')
58
 
59
+ with gr.Tab('Uploaded MP4'):
60
  with gr.Row():
61
  input_file = gr.File(label='Upload MP4')
62
+ output_file_summary = gr.Textbox(placeholder='Summary text of the video', label='Summary')
63
+ output_file_transcription = gr.Textbox(placeholder='Transcription of the video', label='Transcription')
64
+ result_button_file = gr.Button('Process Uploaded MP4')
 
 
 
 
 
65
 
66
+ result_button.click(process_url, inputs=input_text, outputs=[output_summary, output_transcription])
67
+ result_button_file.click(process_file, inputs=input_file, outputs=[output_file_summary, output_file_transcription])
 
 
68
 
69
  demo.launch(debug=True)