Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -263,18 +263,18 @@ print(summarized_text)
|
|
263 |
# the aim of this section of code is to get a summary of just one sentence by summarizing the summary all while the summary is longer than one sentence.
|
264 |
# unfortunately, I tried many many models and none of them actually summarize the text to as short as one sentence.
|
265 |
#I had searched for ways to fine tune the summarization model to specify that the summarization should be done in just one sentence but did not find a way to implement it
|
266 |
-
from transformers import pipeline
|
267 |
-
summarized_text_list_list=summarized_text_list['summary_text']
|
268 |
-
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
|
269 |
#print(summarizer)
|
270 |
-
number_of_sentences=summarized_text_list_list.count('.')
|
271 |
-
print(number_of_sentences)
|
272 |
-
while(number_of_sentences)>1:
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
print(summarized_text_list_list)
|
277 |
-
print(number_of_sentences)
|
278 |
|
279 |
|
280 |
#text to speech
|
@@ -288,10 +288,11 @@ from transformers import pipeline
|
|
288 |
from transformers import SpeechT5Processor, SpeechT5ForTextToSpeech
|
289 |
processor = SpeechT5Processor.from_pretrained("microsoft/speecht5_tts")
|
290 |
model = SpeechT5ForTextToSpeech.from_pretrained("microsoft/speecht5_tts")
|
291 |
-
|
292 |
#text = (summarized_text_list_list)
|
293 |
|
294 |
-
inputs = processor(text=summarized_text_list_list, return_tensors="pt")
|
|
|
295 |
from datasets import load_dataset
|
296 |
embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
|
297 |
|
|
|
263 |
# the aim of this section of code is to get a summary of just one sentence by summarizing the summary all while the summary is longer than one sentence.
|
264 |
# unfortunately, I tried many many models and none of them actually summarize the text to as short as one sentence.
|
265 |
#I had searched for ways to fine tune the summarization model to specify that the summarization should be done in just one sentence but did not find a way to implement it
|
266 |
+
#from transformers import pipeline
|
267 |
+
#summarized_text_list_list=summarized_text_list['summary_text']
|
268 |
+
#summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
|
269 |
#print(summarizer)
|
270 |
+
#number_of_sentences=summarized_text_list_list.count('.')
|
271 |
+
#print(number_of_sentences)
|
272 |
+
#while(number_of_sentences)>1:
|
273 |
+
# print(number_of_sentences)
|
274 |
+
# summarized_text_list_list=summarizer(summarized_text_list_list)[0]['summary_text']
|
275 |
+
# number_of_sentences-=1
|
276 |
+
#print(summarized_text_list_list)
|
277 |
+
#print(number_of_sentences)
|
278 |
|
279 |
|
280 |
#text to speech
|
|
|
288 |
from transformers import SpeechT5Processor, SpeechT5ForTextToSpeech
|
289 |
processor = SpeechT5Processor.from_pretrained("microsoft/speecht5_tts")
|
290 |
model = SpeechT5ForTextToSpeech.from_pretrained("microsoft/speecht5_tts")
|
291 |
+
text = "The future belongs to those who believe in the beauty of their dreams."
|
292 |
#text = (summarized_text_list_list)
|
293 |
|
294 |
+
#inputs = processor(text=summarized_text_list_list, return_tensors="pt")
|
295 |
+
inputs = processor(text, return_tensors="pt")
|
296 |
from datasets import load_dataset
|
297 |
embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
|
298 |
|