WeiHan123 commited on
Commit
89e3d11
·
1 Parent(s): 77c133b

-fix bug

Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -59,15 +59,20 @@ def authenticate(new_username, new_pw):
59
 
60
  def get_user_transcripts(username):
61
  arr = []
62
- if username is None: return [gr.update(value=arr)]
 
 
 
63
  # Fetch user's records
64
  user_transcripts = db.collection(f'Users/{username}/Transcripts').stream()
65
  for trans in user_transcripts:
66
  trans_dict = trans.to_dict()
67
  arr.append([trans_dict['date'], trans_dict['transcription'], trans_dict['sentiment_output']])
68
- # populate empty table
69
- if (len(arr) == 0):
70
- arr = ['', '', '']
 
 
71
  return arr
72
 
73
  def get_user_score(username):
 
59
 
60
  def get_user_transcripts(username):
61
  arr = []
62
+ if username is None:
63
+ # User not logged in, return null transcript
64
+ return ['', '', '']
65
+
66
  # Fetch user's records
67
  user_transcripts = db.collection(f'Users/{username}/Transcripts').stream()
68
  for trans in user_transcripts:
69
  trans_dict = trans.to_dict()
70
  arr.append([trans_dict['date'], trans_dict['transcription'], trans_dict['sentiment_output']])
71
+
72
+ # If no transcripts found, return null transcript
73
+ if len(arr) == 0:
74
+ return ['', '', '']
75
+
76
  return arr
77
 
78
  def get_user_score(username):