codingchild commited on
Commit
8ae9a20
โ€ข
1 Parent(s): e221762

change page2

Browse files
Files changed (1) hide show
  1. vocal_app.py +55 -6
vocal_app.py CHANGED
@@ -85,6 +85,12 @@ def page2_tab_controller():
85
  def page_5_6_controller():
86
  st.session_state.page = "Page 6"
87
 
 
 
 
 
 
 
88
  #########################################################
89
  # Page 1
90
  #########################################################
@@ -123,11 +129,19 @@ def page1():
123
  #########################################################
124
  def page2():
125
  st.header("Choose Option")
126
- st.selectbox("Choose your option", ["Total Debate", "Evaluation Only", "Analyzing Utterances"])
 
 
 
 
 
 
 
 
127
 
128
  if st.button(
129
  label='Submit all information',
130
- on_click=page_2_3_controller
131
  ):
132
  st.write('Information submitted successfully.')
133
 
@@ -306,23 +320,34 @@ def page6():
306
  # ๊ฐ ๋‹จ์–ด์˜ ๋นˆ๋„๋ฅผ ๊ณ„์‚ฐํ•ฉ๋‹ˆ๋‹ค.
307
  total_word_count = Counter(words)
308
  #total_word_count = len(user_history.split())
 
309
 
310
  # ํ‰๊ท  ์†๋„(๋‹จ์–ด/์‹œ๊ฐ„)
311
  user_debate_time = st.session_state.user_debate_time
312
  average_word_per_time = total_word_count / user_debate_time # ์‹œ๊ฐ„ ๋‹จ์œ„๋ณด๊ณ  ๋‚˜์ค‘์— ์ˆ˜์ •ํ•˜๊ธฐ
 
313
 
314
  # 2. ๋นˆ์ถœ ๋‹จ์–ด: ๋ฐ˜๋ณตํ•ด์„œ ์‚ฌ์šฉํ•˜๋Š” ๋‹จ์–ด ๋ฆฌ์ŠคํŠธ
315
  # ๋นˆ๋„๊ฐ€ ๋†’์€ ์ˆœ์„œ๋Œ€๋กœ ๋‹จ์–ด๋ฅผ ์ •๋ ฌํ•ฉ๋‹ˆ๋‹ค.
316
  most_common_words = total_word_count.most_common()
317
- # for word, count in most_common_words:
318
- # print(f"'{word}': {count}")
319
 
320
  # 3. ๋ฐœํ™” ์Šต๊ด€: ๋ถˆํ•„์š”ํ•œ ์–ธ์–ด์Šต๊ด€(์•„, ์Œ)
321
- # ๋ถˆํ•„์š”ํ•œ ์–ธ์–ด์Šต๊ด€์„ ์ •๊ทœํ‘œํ˜„์‹์œผ๋กœ ์ฐพ์•„๋‚ด๊ธฐ
322
  # whisper preprocesser์—์„œ ์ฃผ๋ฉด
323
  disfluency_word_list = ['eh', 'umm', 'ah', 'uh', 'er', 'erm', 'err']
324
  # Count the disfluency words
325
  disfluency_counts = {word: total_word_count[word] for word in disfluency_word_list}
 
 
 
 
 
 
 
 
 
 
326
 
327
 
328
 
@@ -336,7 +361,31 @@ def page6():
336
  # Page7
337
  #########################################################
338
  def page7():
339
- pass
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
340
 
341
 
342
  #########################################################
 
85
  def page_5_6_controller():
86
  st.session_state.page = "Page 6"
87
 
88
+ def page_2_7_controller():
89
+ st.session_state.page = "Page 7"
90
+
91
+ def page_2_8_controller():
92
+ st.session_state.page = "Page 8"
93
+
94
  #########################################################
95
  # Page 1
96
  #########################################################
 
129
  #########################################################
130
  def page2():
131
  st.header("Choose Option")
132
+ option_result = st.selectbox("Choose your option", ["Total Debate", "Evaluation Only", "Analyzing Utterances"])
133
+
134
+ # add controller
135
+ if option_result == "Total Debate":
136
+ page_control_func = page_2_3_controller
137
+ elif option_result == "Evaluation Only":
138
+ page_control_func = page_2_7_controller
139
+ elif option_result == "Analyzing Utterances":
140
+ page_control_func = page_2_8_controller
141
 
142
  if st.button(
143
  label='Submit all information',
144
+ on_click=page_control_func
145
  ):
146
  st.write('Information submitted successfully.')
147
 
 
320
  # ๊ฐ ๋‹จ์–ด์˜ ๋นˆ๋„๋ฅผ ๊ณ„์‚ฐํ•ฉ๋‹ˆ๋‹ค.
321
  total_word_count = Counter(words)
322
  #total_word_count = len(user_history.split())
323
+ st.write("Total Word Count: ", total_word_count)
324
 
325
  # ํ‰๊ท  ์†๋„(๋‹จ์–ด/์‹œ๊ฐ„)
326
  user_debate_time = st.session_state.user_debate_time
327
  average_word_per_time = total_word_count / user_debate_time # ์‹œ๊ฐ„ ๋‹จ์œ„๋ณด๊ณ  ๋‚˜์ค‘์— ์ˆ˜์ •ํ•˜๊ธฐ
328
+ st.write("Average Word Per Time: ", average_word_per_time)
329
 
330
  # 2. ๋นˆ์ถœ ๋‹จ์–ด: ๋ฐ˜๋ณตํ•ด์„œ ์‚ฌ์šฉํ•˜๋Š” ๋‹จ์–ด ๋ฆฌ์ŠคํŠธ
331
  # ๋นˆ๋„๊ฐ€ ๋†’์€ ์ˆœ์„œ๋Œ€๋กœ ๋‹จ์–ด๋ฅผ ์ •๋ ฌํ•ฉ๋‹ˆ๋‹ค.
332
  most_common_words = total_word_count.most_common()
333
+ # ๊ฐ€์žฅ ๋นˆ๋„๊ฐ€ ๋†’์€ 10๊ฐœ์˜ ๋‹จ์–ด๋ฅผ ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค.
334
+ st.write("Most Common Words: ", most_common_words[:10])
335
 
336
  # 3. ๋ฐœํ™” ์Šต๊ด€: ๋ถˆํ•„์š”ํ•œ ์–ธ์–ด์Šต๊ด€(์•„, ์Œ)
 
337
  # whisper preprocesser์—์„œ ์ฃผ๋ฉด
338
  disfluency_word_list = ['eh', 'umm', 'ah', 'uh', 'er', 'erm', 'err']
339
  # Count the disfluency words
340
  disfluency_counts = {word: total_word_count[word] for word in disfluency_word_list}
341
+ st.write("Disfluency Counts: ", disfluency_counts)
342
+
343
+
344
+ ############################################
345
+ # Visualization
346
+ ############################################
347
+
348
+ # ์ด์ „์— ๊ธฐ๋ก๋œ ๊ฐ’์ด ์žˆ๋‹ค๋ฉด, ๊ทธ๋ž˜ํ”„๋ฅผ ๊ทธ๋ฆฝ๋‹ˆ๋‹ค.
349
+ # ์ด์ „์— ๊ธฐ๋ก๋œ ๊ฐ’์ด ์—†๋‹ค๋ฉด, ๊ทธ๋ž˜ํ”„๋ฅผ ๊ทธ๋ฆฌ์ง€ ์•Š์Šต๋‹ˆ๋‹ค.
350
+
351
 
352
 
353
 
 
361
  # Page7
362
  #########################################################
363
  def page7():
364
+ st.header('Debate Judgement')
365
+ # ์œ ์ €์™€ ๋ด‡์˜ ๋Œ€ํ™” ๋ฐ์ดํ„ฐ๊ฐ€ ์„ธ์…˜์— ๋‚จ์•„์žˆ์Œ
366
+ # st.session_state.debate_history
367
+
368
+ debate_themes = ['User-Bot', "User", "Bot"]
369
+
370
+ # ์ „์ฒด, ์œ ์ €, ๋ด‡ ์„ธ ๊ฐ€์ง€ ์˜ต์…˜ ์ค‘์— ์„ ํƒ
371
+ judgement_who = st.selectbox("Choose your debate theme", debate_themes)
372
+
373
+ if judgement_who == 'User-Bot':
374
+ debate_history = st.session_state.total_debate_history
375
+ elif judgement_who == 'User':
376
+ debate_history = st.session_state.user_debate_history
377
+ elif judgement_who == 'Bot':
378
+ debate_history = st.session_state.bot_debate_history
379
+
380
+ judgement_result = debate_judgement(debate_history)
381
+
382
+ st.write("Debate Judgement Result")
383
+ st.write(judgement_result)
384
+
385
+ st.button(
386
+ label='Move to Debate Dashboard',
387
+ on_click=page_5_6_controller
388
+ )
389
 
390
 
391
  #########################################################