Spaces:
Build error
Build error
formatted app
Browse files
app.py
CHANGED
|
@@ -60,27 +60,33 @@ def fin_ext(text):
|
|
| 60 |
|
| 61 |
demo = gr.Blocks()
|
| 62 |
|
| 63 |
-
|
| 64 |
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
|
| 86 |
demo.launch()
|
|
|
|
| 60 |
|
| 61 |
demo = gr.Blocks()
|
| 62 |
|
| 63 |
+
demo = gr.Blocks()
|
| 64 |
|
| 65 |
+
with demo:
|
| 66 |
+
with gr.Row():
|
| 67 |
+
with gr.Column():
|
| 68 |
+
audio_file = gr.inputs.Audio(source="microphone", type="filepath")
|
| 69 |
+
with gr.Row():
|
| 70 |
+
b1 = gr.Button("Recognize Speech")
|
| 71 |
+
with gr.Row():
|
| 72 |
+
text = gr.Textbox(value="US retail sales fell in May for the first time in five months, restrained by a plunge in auto purchases and other big-ticket items, suggesting moderating demand for goods amid decades-high inflation. The value of overall retail purchases decreased 0.3%, after a downwardly revised 0.7% gain in April, Commerce Department figures showed Wednesday. Excluding vehicles, sales rose 0.5% last month. The figures aren’t adjusted for inflation.")
|
| 73 |
+
b1.click(speech_to_text, inputs=audio_file, outputs=text)
|
| 74 |
+
with gr.Row():
|
| 75 |
+
b2 = gr.Button("Summarize Text")
|
| 76 |
+
stext = gr.Textbox()
|
| 77 |
+
b2.click(summarize_text, inputs=text, outputs=stext)
|
| 78 |
+
with gr.Column():
|
| 79 |
+
with gr.Row():
|
| 80 |
+
b3 = gr.Button("Classify Overall Financial Sentiment")
|
| 81 |
+
label = gr.Label()
|
| 82 |
+
b3.click(text_to_sentiment, inputs=stext, outputs=label)
|
| 83 |
+
with gr.Row():
|
| 84 |
+
b4 = gr.Button("Extract Companies & Segments")
|
| 85 |
+
replaced_spans = gr.HighlightedText()
|
| 86 |
+
b4.click(fin_ner, inputs=text, outputs=replaced_spans)
|
| 87 |
+
with gr.Row():
|
| 88 |
+
b5 = gr.Button("Extract Financial Sentiment")
|
| 89 |
+
fin_spans = gr.HighlightedText()
|
| 90 |
+
b5.click(fin_ext, inputs=text, outputs=fin_spans)
|
| 91 |
|
| 92 |
demo.launch()
|