Commit ·
779bac5
1
Parent(s): e626541
Update app.py
Browse files
app.py
CHANGED
|
@@ -122,9 +122,10 @@ def process_transcript_and_extract_qa(output):
|
|
| 122 |
if 'SPEAKER 2' in lines[j]:
|
| 123 |
a = lines[j].split(': ')[1]
|
| 124 |
qa_dict['Q: ' + q] = 'A: ' + a
|
| 125 |
-
break
|
| 126 |
-
|
| 127 |
-
|
|
|
|
| 128 |
|
| 129 |
demo = gr.Blocks()
|
| 130 |
|
|
@@ -136,13 +137,13 @@ with demo:
|
|
| 136 |
audio_file = gr.Audio(type="filepath")
|
| 137 |
output = gr.Textbox(label ='Transcript')
|
| 138 |
sentiment_score = gr.Label(label ='Sentiment Score')
|
| 139 |
-
|
| 140 |
|
| 141 |
b1 = gr.Button("Transcribe Call")
|
| 142 |
b1.click(transcribe, inputs=audio_file, outputs=output)
|
| 143 |
|
| 144 |
b2 = gr.Button("Identify Questions and Answers")
|
| 145 |
-
b2.click(process_transcript_and_extract_qa, inputs=output, outputs=
|
| 146 |
|
| 147 |
b3 = gr.Button("Classify Sentiment")
|
| 148 |
b3.click(calculate_sentiment_score, inputs=output, outputs=sentiment_score)
|
|
|
|
| 122 |
if 'SPEAKER 2' in lines[j]:
|
| 123 |
a = lines[j].split(': ')[1]
|
| 124 |
qa_dict['Q: ' + q] = 'A: ' + a
|
| 125 |
+
break
|
| 126 |
+
q_a_list = [f"{key}: {value}" for key, value in qa_dict.items()]
|
| 127 |
+
output_str = "\n".join(q_a_list)
|
| 128 |
+
return output_str
|
| 129 |
|
| 130 |
demo = gr.Blocks()
|
| 131 |
|
|
|
|
| 137 |
audio_file = gr.Audio(type="filepath")
|
| 138 |
output = gr.Textbox(label ='Transcript')
|
| 139 |
sentiment_score = gr.Label(label ='Sentiment Score')
|
| 140 |
+
output_str = gr.Textbox(label='Questions and Answers')
|
| 141 |
|
| 142 |
b1 = gr.Button("Transcribe Call")
|
| 143 |
b1.click(transcribe, inputs=audio_file, outputs=output)
|
| 144 |
|
| 145 |
b2 = gr.Button("Identify Questions and Answers")
|
| 146 |
+
b2.click(process_transcript_and_extract_qa, inputs=output, outputs=output_str)
|
| 147 |
|
| 148 |
b3 = gr.Button("Classify Sentiment")
|
| 149 |
b3.click(calculate_sentiment_score, inputs=output, outputs=sentiment_score)
|