remotewith commited on
Commit
7d7e2c1
1 Parent(s): 17056be

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -1
app.py CHANGED
@@ -17,7 +17,10 @@ import contextlib
17
  from sklearn.cluster import AgglomerativeClustering
18
  import numpy as np
19
 
 
20
 
 
 
21
  def audio_to_text(audio, num_speakers):
22
  path, error = convert_to_wav(audio)
23
  if error is not None:
@@ -88,7 +91,25 @@ def get_output(segments):
88
  output += '\n\n'
89
  output += segment["speaker"] + ' ' + str(time(segment["start"])) + '\n\n'
90
  output += segment["text"][1:] + ' '
91
- return output
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
 
93
  app1=gr.Interface(
94
  title = 'AI Voice to Text',
 
17
  from sklearn.cluster import AgglomerativeClustering
18
  import numpy as np
19
 
20
+ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
21
 
22
+
23
+ ######################################################
24
  def audio_to_text(audio, num_speakers):
25
  path, error = convert_to_wav(audio)
26
  if error is not None:
 
91
  output += '\n\n'
92
  output += segment["speaker"] + ' ' + str(time(segment["start"])) + '\n\n'
93
  output += segment["text"][1:] + ' '
94
+
95
+ return output
96
+
97
+ #########################################################################
98
+
99
+
100
+ def_text_to_short_summary(text):
101
+ tokenizer = AutoTokenizer.from_pretrained("knkarthick/MEETING-SUMMARY-BART-LARGE-XSUM-SAMSUM-DIALOGSUM")
102
+
103
+ model = AutoModelForSeq2SeqLM.from_pretrained("knkarthick/MEETING-SUMMARY-BART-LARGE-XSUM-SAMSUM-DIALOGSUM")
104
+
105
+ from transformers import pipeline
106
+ summarizer = pipeline("summarization", model="knkarthick/MEETING-SUMMARY-BART-LARGE-XSUM-SAMSUM-DIALOGSUM")
107
+ text = '''The tower is 324 metres (1,063 ft) tall, about the same height as an 81-storey building, and the tallest structure in Paris. Its base is square, measuring 125 metres (410 ft) on each side. During its construction, the Eiffel Tower surpassed the Washington Monument to become the tallest man-made structure in the world, a title it held for 41 years until the Chrysler Building in New York City was finished in 1930. It was the first structure to reach a height of 300 metres. Due to the addition of a broadcasting aerial at the top of the tower in 1957, it is now taller than the Chrysler Building by 5.2 metres (17 ft). Excluding transmitters, the Eiffel Tower is the second tallest free-standing structure in France after the Millau Viaduct.
108
+ '''
109
+ return summarizer(text)
110
+
111
+
112
+
113
 
114
  app1=gr.Interface(
115
  title = 'AI Voice to Text',