Spaces:
Running
Running
moving things around a bit - pushing up
Browse files
README.md
CHANGED
@@ -11,6 +11,8 @@ license: mit
|
|
11 |
short_description: A data dashboard for all U.S. State of the Unions.
|
12 |
datasets:
|
13 |
- jsulz/state-of-the-union-addresses
|
|
|
|
|
14 |
---
|
15 |
|
16 |
# State of the Union Analysis
|
|
|
11 |
short_description: A data dashboard for all U.S. State of the Unions.
|
12 |
datasets:
|
13 |
- jsulz/state-of-the-union-addresses
|
14 |
+
models:
|
15 |
+
- Qwen/Qwen2.5-72B-Instruct
|
16 |
---
|
17 |
|
18 |
# State of the Union Analysis
|
app.py
CHANGED
@@ -201,32 +201,46 @@ with gr.Blocks() as demo:
|
|
201 |
)
|
202 |
|
203 |
gr.Markdown(
|
204 |
-
"In addition to analyzing the content, this space also leverages the [Qwen/2.5-72B-Instruct](https://deepinfra.com/Qwen/Qwen2.5-72B-Instruct) model to summarize a speech. The model is tasked with providing a concise summary of a speech from a given president.
|
205 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
# Basic line chart showing the total number of words in each address
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
The line chart to the right shows the total number of words in each address. However, not all SOTUs are created equally. From 1801 to 1916, each address was a written message to Congress. In 1913, Woodrow Wilson broke with tradition and delivered his address in person. Since then, the addresses have been a mix of written and spoken (mostly spoken).
|
212 |
|
213 |
-
|
214 |
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
# group by president and category and calculate the average word count sort by date
|
231 |
avg_word_count = (
|
232 |
df.groupby(["potus", "categories"])["word_count"].mean().reset_index()
|
@@ -313,19 +327,4 @@ with gr.Blocks() as demo:
|
|
313 |
# show a line chart of word count and ARI for a selected president
|
314 |
gr.Plot(plotly_word_and_ari, inputs=[president, df_state])
|
315 |
|
316 |
-
gr.Markdown("## Summarize a Speech")
|
317 |
-
gr.HTML("<div id=summarize-anchor></div>")
|
318 |
-
gr.Markdown(
|
319 |
-
"""
|
320 |
-
Use the dropdown to select a speech from a president and click the button to summarize the speech. The model will provide a concise summary of the speech with the proper historical and political context.
|
321 |
-
"""
|
322 |
-
)
|
323 |
-
speeches = df["speech_key"].unique()
|
324 |
-
speeches = speeches.tolist()
|
325 |
-
speech = gr.Dropdown(label="Select a Speech", choices=speeches)
|
326 |
-
# create a dropdown to select a speech from a president
|
327 |
-
run_summarization = gr.Button(value="Summarize")
|
328 |
-
fin_speech = gr.Textbox(label="Summarized Speech", type="text", lines=10)
|
329 |
-
run_summarization.click(streaming, inputs=[speech, df_state], outputs=[fin_speech])
|
330 |
-
|
331 |
demo.launch()
|
|
|
201 |
)
|
202 |
|
203 |
gr.Markdown(
|
204 |
+
"In addition to analyzing the content, this space also leverages the [Qwen/2.5-72B-Instruct](https://deepinfra.com/Qwen/Qwen2.5-72B-Instruct) model to summarize a speech. The model is tasked with providing a concise summary of a speech from a given president."
|
205 |
)
|
206 |
+
gr.Markdown("## Summarize a Speech")
|
207 |
+
gr.HTML("<div id=summarize-anchor></div>")
|
208 |
+
gr.Markdown(
|
209 |
+
"""
|
210 |
+
Context is king, so before we start looking at the speeches in the aggregate, get a summary of a State of the Union first. Use the dropdown to select a speech from a president and click the button to summarize the speech. [Qwen/2.5-72B-Instruct](https://deepinfra.com/Qwen/Qwen2.5-72B-Instruct) will provide a concise summary of the speech with the proper historical and political context.
|
211 |
+
"""
|
212 |
+
)
|
213 |
+
speeches = df["speech_key"].unique()
|
214 |
+
speeches = speeches.tolist()
|
215 |
+
speech = gr.Dropdown(label="Select a Speech", choices=speeches)
|
216 |
+
# create a dropdown to select a speech from a president
|
217 |
+
run_summarization = gr.Button(value="Summarize")
|
218 |
+
fin_speech = gr.Textbox(label="Summarized Speech", type="text", lines=10)
|
219 |
+
run_summarization.click(streaming, inputs=[speech, df_state], outputs=[fin_speech])
|
220 |
+
|
221 |
# Basic line chart showing the total number of words in each address
|
222 |
+
gr.Markdown(
|
223 |
+
"""
|
224 |
+
## The shape of words
|
225 |
+
The line chart to the right shows the total number of words in each address. However, not all SOTUs are created equally. From 1801 to 1916, each address was a written message to Congress. In 1913, Woodrow Wilson broke with tradition and delivered his address in person. Since then, the addresses have been a mix of written and spoken (mostly spoken).
|
|
|
226 |
|
227 |
+
The spikes you see in the early 1970's and early 1980's are from written addresses by Richard Nixon and Jimmy Carter respectively.
|
228 |
|
229 |
+
Now that we have a little historical context, what does this data look like if we split things out by president? The bar chart below shows the average number of words in each address by president. The bars are grouped by written and spoken addresses.
|
230 |
+
"""
|
231 |
+
)
|
232 |
+
fig1 = px.line(
|
233 |
+
df,
|
234 |
+
x="date",
|
235 |
+
y="word_count",
|
236 |
+
title="Total Number of Words in Addresses",
|
237 |
+
line_shape="spline",
|
238 |
+
)
|
239 |
+
fig1.update_layout(
|
240 |
+
xaxis=dict(title="Date of Address"),
|
241 |
+
yaxis=dict(title="Word Count"),
|
242 |
+
)
|
243 |
+
gr.Plot(fig1, scale=2)
|
244 |
# group by president and category and calculate the average word count sort by date
|
245 |
avg_word_count = (
|
246 |
df.groupby(["potus", "categories"])["word_count"].mean().reset_index()
|
|
|
327 |
# show a line chart of word count and ARI for a selected president
|
328 |
gr.Plot(plotly_word_and_ari, inputs=[president, df_state])
|
329 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
330 |
demo.launch()
|