RamAnanth1 commited on
Commit
e268f63
·
1 Parent(s): 18a3794

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -8
app.py CHANGED
@@ -3,6 +3,7 @@ import os
3
  import json
4
  import requests
5
  import time
 
6
 
7
  # AssemblyAI transcript endpoint (where we submit the file)
8
  transcript_endpoint = "https://api.assemblyai.com/v2/transcript"
@@ -87,13 +88,10 @@ def get_transcript_url(url):
87
  print(type(res))
88
  sentiment_analysis_result = ''
89
 
90
- print(res[0])
91
- for elt in res:
92
- sentiment_analysis_result = sentiment_analysis_result + "TEXT: "+ elt['text']+ "\n"
93
- sentiment_analysis_result = sentiment_analysis_result + "SENTIMENT: " + elt['sentiment'] + "\n"
94
- sentiment_analysis_result = sentiment_analysis_result + "CONFIDENCE: " + str(round(float(elt['confidence']), 2)) + "\n"
95
-
96
- return transcription_result['text'], transcription_result['summary'], sentiment_analysis_result
97
 
98
  # def get_transcript_file(filename):
99
 
@@ -188,7 +186,7 @@ with gr.Blocks() as demo:
188
  with gr.TabItem('Summary', visible = False) as summary_tab:
189
  summary = gr.Textbox(label = "Summary Result")
190
  with gr.TabItem('Sentiment Analysis', visible = False) as sentiment_tab:
191
- sentiment_analysis = gr.Textbox(label = "Sentiment Analysis Result" )
192
 
193
 
194
  inputs.submit(get_transcript_url, [inputs], [transcript, summary, sentiment_analysis])
 
3
  import json
4
  import requests
5
  import time
6
+ import pandas as pd
7
 
8
  # AssemblyAI transcript endpoint (where we submit the file)
9
  transcript_endpoint = "https://api.assemblyai.com/v2/transcript"
 
88
  print(type(res))
89
  sentiment_analysis_result = ''
90
 
91
+ df = pd.DataFrame(res)
92
+ df = df.loc[:, ["text", "sentiment", "confidence"]]
93
+
94
+ return transcription_result['text'], transcription_result['summary'], df
 
 
 
95
 
96
  # def get_transcript_file(filename):
97
 
 
186
  with gr.TabItem('Summary', visible = False) as summary_tab:
187
  summary = gr.Textbox(label = "Summary Result")
188
  with gr.TabItem('Sentiment Analysis', visible = False) as sentiment_tab:
189
+ sentiment_analysis = gr.Dataframe(label = "Sentiment Analysis Result" )
190
 
191
 
192
  inputs.submit(get_transcript_url, [inputs], [transcript, summary, sentiment_analysis])