rajistics commited on
Commit
f9c9210
1 Parent(s): d59a44b

formatted app

Browse files
Files changed (1) hide show
  1. app.py +27 -21
app.py CHANGED
@@ -60,27 +60,33 @@ def fin_ext(text):
60
 
61
  demo = gr.Blocks()
62
 
63
- with demo:
64
 
65
- audio_file = gr.inputs.Audio(source="microphone", type="filepath")
66
- b1 = gr.Button("Recognize Speech")
67
- 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.")
68
- b1.click(speech_to_text, inputs=audio_file, outputs=text)
69
-
70
- b2 = gr.Button("Summarize Text")
71
- stext = gr.Textbox()
72
- b2.click(summarize_text, inputs=text, outputs=stext)
73
-
74
- b3 = gr.Button("Classify Overall Financial Sentiment")
75
- label = gr.Label()
76
- b3.click(text_to_sentiment, inputs=stext, outputs=label)
77
-
78
- b4 = gr.Button("Extract Companies & Segments")
79
- replaced_spans = gr.HighlightedText()
80
- b4.click(fin_ner, inputs=text, outputs=replaced_spans)
81
-
82
- b5 = gr.Button("Extract Financial Sentiment")
83
- fin_spans = gr.HighlightedText()
84
- b5.click(fin_ext, inputs=text, outputs=fin_spans)
 
 
 
 
 
 
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()