Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -30,7 +30,7 @@ def YTVideoToText(video_link):
|
|
30 |
summarized_text2 = ' '.join(summarized_text)
|
31 |
|
32 |
# returning summary
|
33 |
-
return summarized_text2;
|
34 |
|
35 |
|
36 |
# How to use: postSummaryWithBart("https://ethereum.org/en/what-is-ethereum/")
|
@@ -80,7 +80,7 @@ def postSummaryWithBart(blog_link):
|
|
80 |
text = ''.join([summ['summary_text'] for summ in res])
|
81 |
|
82 |
# returning summary
|
83 |
-
return text;
|
84 |
|
85 |
|
86 |
# How to use: abstractiveSummaryWithPegasus("""Sample text to be summarized""")
|
@@ -99,10 +99,12 @@ def abstractiveSummaryWithPegasus(words):
|
|
99 |
print(actual_summ)
|
100 |
|
101 |
|
102 |
-
|
103 |
# Main logic of the program
|
104 |
def process(uri, mode):
|
105 |
-
|
|
|
|
|
|
|
106 |
|
107 |
|
108 |
import gradio as gr
|
@@ -122,7 +124,6 @@ with gr.Blocks() as ui:
|
|
122 |
TRANSCRIPT = gr.Textbox(
|
123 |
label="URI Γ rΓ©sumer",
|
124 |
lines=10,
|
125 |
-
interactive=False,
|
126 |
placeholder="https://youtube|website.ext",
|
127 |
)
|
128 |
RESUME = gr.Textbox(
|
@@ -131,13 +132,18 @@ with gr.Blocks() as ui:
|
|
131 |
interactive=False,
|
132 |
placeholder="https://youtube|website.ext",
|
133 |
)
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
|
|
|
|
|
|
|
|
|
|
141 |
|
142 |
#translator_fr = gr.Interface.load("huggingface/Helsinki-NLP/opus-mt-fr-en")
|
143 |
#summarizer = gr.Interface.load("huggingface/sshleifer/distilbart-cnn-12-6")
|
|
|
30 |
summarized_text2 = ' '.join(summarized_text)
|
31 |
|
32 |
# returning summary
|
33 |
+
return [result, summarized_text2];
|
34 |
|
35 |
|
36 |
# How to use: postSummaryWithBart("https://ethereum.org/en/what-is-ethereum/")
|
|
|
80 |
text = ''.join([summ['summary_text'] for summ in res])
|
81 |
|
82 |
# returning summary
|
83 |
+
return [sentences, text];
|
84 |
|
85 |
|
86 |
# How to use: abstractiveSummaryWithPegasus("""Sample text to be summarized""")
|
|
|
99 |
print(actual_summ)
|
100 |
|
101 |
|
|
|
102 |
# Main logic of the program
|
103 |
def process(uri, mode):
|
104 |
+
if mode == "Youtube"
|
105 |
+
return YTVideoToText(uri)
|
106 |
+
if mode == "Blog"
|
107 |
+
return postSummaryWithBart(uri)
|
108 |
|
109 |
|
110 |
import gradio as gr
|
|
|
124 |
TRANSCRIPT = gr.Textbox(
|
125 |
label="URI Γ rΓ©sumer",
|
126 |
lines=10,
|
|
|
127 |
placeholder="https://youtube|website.ext",
|
128 |
)
|
129 |
RESUME = gr.Textbox(
|
|
|
132 |
interactive=False,
|
133 |
placeholder="https://youtube|website.ext",
|
134 |
)
|
135 |
+
with gr.Column():
|
136 |
+
MODE = gr.Radio(choices=["Youtube", "Blog", "Text"])
|
137 |
+
gr.Button("Process URI").click(
|
138 |
+
fn=process,
|
139 |
+
inputs=[URI, MODE],
|
140 |
+
outputs=[TRANSCRIPT, RESUME]
|
141 |
+
)
|
142 |
+
gr.Button("Process TEXT").click(
|
143 |
+
fn=abstractiveSummaryWithPegasus,
|
144 |
+
inputs=[TRANSCRIPT],
|
145 |
+
outputs=[RESUME]
|
146 |
+
)
|
147 |
|
148 |
#translator_fr = gr.Interface.load("huggingface/Helsinki-NLP/opus-mt-fr-en")
|
149 |
#summarizer = gr.Interface.load("huggingface/sshleifer/distilbart-cnn-12-6")
|