Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +17 -15
src/streamlit_app.py
CHANGED
|
@@ -22,22 +22,23 @@ options = [
|
|
| 22 |
"2024-09-26"
|
| 23 |
]
|
| 24 |
selected_text = st.selectbox("데이터를 선택하세요", options)
|
| 25 |
-
print(selected_text)
|
| 26 |
|
| 27 |
-
|
|
|
|
| 28 |
<style>
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
</style>
|
| 36 |
-
|
| 37 |
-
<button class="icon-button" type="submit" name="mic">🎤</button>
|
| 38 |
-
</form>
|
| 39 |
-
"""
|
| 40 |
-
st.markdown(button_html, unsafe_allow_html=True)
|
| 41 |
|
| 42 |
# 데이터 상태 및 조치 상황 표시 함수
|
| 43 |
def display_status_and_action(text):
|
|
@@ -52,13 +53,14 @@ def display_status_and_action(text):
|
|
| 52 |
st.warning(warning)
|
| 53 |
st.markdown(text_input)
|
| 54 |
# 버튼 클릭 처리
|
| 55 |
-
if st.
|
| 56 |
-
|
| 57 |
text_input = warning + " " + text_input
|
| 58 |
cleaned_text = re.sub(r'[\x00-\x1F]+', '', text_input).replace("*", "")
|
| 59 |
tts = gTTS(text=cleaned_text, lang='ko')
|
| 60 |
mp3_fp = BytesIO()
|
| 61 |
tts.write_to_fp(mp3_fp)
|
|
|
|
|
|
|
| 62 |
mp3_fp.seek(0)
|
| 63 |
st.audio(mp3_fp, format="audio/mp3")
|
| 64 |
|
|
|
|
| 22 |
"2024-09-26"
|
| 23 |
]
|
| 24 |
selected_text = st.selectbox("데이터를 선택하세요", options)
|
|
|
|
| 25 |
|
| 26 |
+
# 커스텀 CSS 삽입
|
| 27 |
+
st.markdown("""
|
| 28 |
<style>
|
| 29 |
+
div.stButton > button {
|
| 30 |
+
background-color: transparent;
|
| 31 |
+
border: none;
|
| 32 |
+
color: black;
|
| 33 |
+
font-size: 30px;
|
| 34 |
+
padding: 0;
|
| 35 |
+
}
|
| 36 |
+
div.stButton > button:hover {
|
| 37 |
+
color: red;
|
| 38 |
+
cursor: pointer;
|
| 39 |
+
}
|
| 40 |
</style>
|
| 41 |
+
""", unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
# 데이터 상태 및 조치 상황 표시 함수
|
| 44 |
def display_status_and_action(text):
|
|
|
|
| 53 |
st.warning(warning)
|
| 54 |
st.markdown(text_input)
|
| 55 |
# 버튼 클릭 처리
|
| 56 |
+
if st.button("🎤", help="음성으로 듣기"):
|
|
|
|
| 57 |
text_input = warning + " " + text_input
|
| 58 |
cleaned_text = re.sub(r'[\x00-\x1F]+', '', text_input).replace("*", "")
|
| 59 |
tts = gTTS(text=cleaned_text, lang='ko')
|
| 60 |
mp3_fp = BytesIO()
|
| 61 |
tts.write_to_fp(mp3_fp)
|
| 62 |
+
|
| 63 |
+
# 오디오 스트림 재설정 후 재생
|
| 64 |
mp3_fp.seek(0)
|
| 65 |
st.audio(mp3_fp, format="audio/mp3")
|
| 66 |
|