Spaces:
Runtime error
Runtime error
codingchild
commited on
Commit
โข
8ae9a20
1
Parent(s):
e221762
change page2
Browse files- 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=
|
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 |
-
#
|
318 |
-
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
#########################################################
|