Spaces:
Running
Running
RoadToIron
commited on
Commit
·
f3ff82d
1
Parent(s):
7a5de34
added the app file
Browse files
app.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import pipeline
|
| 2 |
+
import gradio as gr
|
| 3 |
+
import tensorflow as tf
|
| 4 |
+
|
| 5 |
+
#load the gpt model
|
| 6 |
+
talker = pipeline("text-to-speech", model="facebook/fastspeech2-en-ljspeech")
|
| 7 |
+
answerer = pipeline("summarization", model="facebook/bart-large-cnn")
|
| 8 |
+
|
| 9 |
+
def summarize_and_tts(text):
|
| 10 |
+
# Summarize the input text
|
| 11 |
+
summary = answerer(text, max_length=50, min_length=25, do_sample=False)[0][text]
|
| 12 |
+
|
| 13 |
+
# Convert the summary to speech
|
| 14 |
+
tts_output = talker(summary)
|
| 15 |
+
|
| 16 |
+
return summary, tts_output['audio']
|
| 17 |
+
|
| 18 |
+
# the Gradio Interface
|
| 19 |
+
with gr.Blocks() as demo:
|
| 20 |
+
text_input = gr.Textbox(label="Enter text to summarize and convert to speech", lines=10)
|
| 21 |
+
summary_output = gr.Textbox(label="Summary")
|
| 22 |
+
audio_output = gr.Audio(label="Text-to-Speech Output", type="numpy")
|
| 23 |
+
submit_button = gr.Button("Submit")
|
| 24 |
+
|
| 25 |
+
demo.launch()
|
bashrc
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
qs
|
| 3 |
+
wq
|
| 4 |
+
ew
|
| 5 |
+
rqw
|
| 6 |
+
|
makefile
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
install:
|
| 2 |
+
pip install -r requirements.txt
|
| 3 |
+
test:
|
| 4 |
+
python -m pytest
|
| 5 |
+
|
| 6 |
+
debug:
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
tensorflow
|
| 2 |
+
gradio
|
| 3 |
+
transformers
|