kkastr
commited on
Commit
•
3613d05
1
Parent(s):
6dccd1c
mirror main changes
Browse files
app.py
CHANGED
@@ -162,6 +162,8 @@ if __name__ == "__main__":
|
|
162 |
sum_api = gr.Interface.load(sum_model, api_key=hf_token)
|
163 |
clf_api = gr.Interface.load(clf_model, api_key=hf_token)
|
164 |
|
|
|
|
|
165 |
with gr.Blocks(css=".gradio-container {max-width: 900px !important; width: 100%}") as demo:
|
166 |
submission_url = gr.Textbox(label='Post URL')
|
167 |
|
@@ -169,16 +171,25 @@ if __name__ == "__main__":
|
|
169 |
|
170 |
title = gr.Markdown("")
|
171 |
|
172 |
-
with gr.
|
173 |
-
|
174 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
|
176 |
-
|
177 |
-
long_summary = gr.Textbox(label='Long Summary')
|
178 |
|
179 |
-
|
180 |
-
|
181 |
-
|
|
|
|
|
182 |
|
183 |
try:
|
184 |
demo.launch()
|
|
|
162 |
sum_api = gr.Interface.load(sum_model, api_key=hf_token)
|
163 |
clf_api = gr.Interface.load(clf_model, api_key=hf_token)
|
164 |
|
165 |
+
sample_urls = ['https://www.reddit.com/r/wholesome/comments/10ehlxo/he_got_a_strong_message/']
|
166 |
+
|
167 |
with gr.Blocks(css=".gradio-container {max-width: 900px !important; width: 100%}") as demo:
|
168 |
submission_url = gr.Textbox(label='Post URL')
|
169 |
|
|
|
171 |
|
172 |
title = gr.Markdown("")
|
173 |
|
174 |
+
with gr.Column(visible=False) as result_col:
|
175 |
+
with gr.Row():
|
176 |
+
with gr.Column():
|
177 |
+
short_summary = gr.Textbox(label='Short Summary')
|
178 |
+
summary_sentiment = gr.Label(label='Sentiment')
|
179 |
+
|
180 |
+
thread_cloud = gr.Plot(label='Word Cloud')
|
181 |
+
|
182 |
+
long_summary = gr.Textbox(label='Long Summary')
|
183 |
+
|
184 |
+
out_lst = [result_col, title, short_summary, long_summary, summary_sentiment, thread_cloud]
|
185 |
|
186 |
+
sub_btn.click(fn=summarizer, inputs=[submission_url], outputs=out_lst)
|
|
|
187 |
|
188 |
+
examples = gr.Examples(examples=sample_urls,
|
189 |
+
fn=summarizer,
|
190 |
+
inputs=[submission_url],
|
191 |
+
outputs=out_lst,
|
192 |
+
cache_examples=True)
|
193 |
|
194 |
try:
|
195 |
demo.launch()
|