JUNGU commited on
Commit
e2967cd
ยท
1 Parent(s): b32c315

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -85,10 +85,14 @@ if st.button("ํ‰๊ฐ€ ์ƒ์„ฑ"):
85
  result_lines = result.split('\n')
86
  sentences = []
87
  for line in result_lines:
88
- if line.strip().startswith('("'):
89
- sentence = line.split('",')[0].lstrip('("').strip()
 
 
 
90
  sentences.append(sentence)
91
 
 
92
  # ๋ฌธ์žฅ์„ ๋ผ๋””์˜ค ๋ฒ„ํŠผ์œผ๋กœ ํ‘œ์‹œ ๋ฐ ์„ ํƒ๋œ ๋ฌธ์žฅ ์ €์žฅ
93
  selected_index = st.radio("๋ฌธ์žฅ์„ ์„ ํƒํ•˜์„ธ์š”:", range(len(sentences)), format_func=lambda x: sentences[x])
94
  st.session_state.selected_sentence = sentences[selected_index] if sentences else None
 
85
  result_lines = result.split('\n')
86
  sentences = []
87
  for line in result_lines:
88
+ # "(" ๋ฌธ์ž์—ด์ด ํฌํ•จ๋œ ์œ„์น˜๋ฅผ ์ฐพ์•„์„œ ๊ทธ ์ดํ›„์˜ ๋ฌธ์ž์—ด๋งŒ ์ถ”์ถœ
89
+ start_idx = line.find('("')
90
+ if start_idx != -1:
91
+ end_idx = line.find('",', start_idx)
92
+ sentence = line[start_idx + 2:end_idx].strip() # "(" ๋‹ค์Œ๋ถ€ํ„ฐ "," ์ „๊นŒ์ง€์˜ ๋ฌธ์ž์—ด์„ ์ถ”์ถœ
93
  sentences.append(sentence)
94
 
95
+
96
  # ๋ฌธ์žฅ์„ ๋ผ๋””์˜ค ๋ฒ„ํŠผ์œผ๋กœ ํ‘œ์‹œ ๋ฐ ์„ ํƒ๋œ ๋ฌธ์žฅ ์ €์žฅ
97
  selected_index = st.radio("๋ฌธ์žฅ์„ ์„ ํƒํ•˜์„ธ์š”:", range(len(sentences)), format_func=lambda x: sentences[x])
98
  st.session_state.selected_sentence = sentences[selected_index] if sentences else None