leewatson commited on
Commit
f8d9884
ยท
verified ยท
1 Parent(s): 6741ae0

Update emotion_predictor.py

Browse files
Files changed (1) hide show
  1. emotion_predictor.py +1 -21
emotion_predictor.py CHANGED
@@ -10,7 +10,6 @@ from sklearn.linear_model import LinearRegression
10
  from collections import defaultdict
11
  import base64
12
  from io import BytesIO
13
- import streamlit as st
14
 
15
  # ํฐํŠธ ์„ค์ •
16
  font_path = './NanumGothic.ttf'
@@ -136,23 +135,4 @@ def predict_and_plot(raw_text):
136
  else:
137
  html_output += "<p>โš ๏ธ ์‹œ๊ฐํ™”ํ•  ์ˆ˜ ์žˆ๋Š” ๊ฐ์ •์ด ์—†์Šต๋‹ˆ๋‹ค.</p><hr/>"
138
 
139
- return html_output
140
-
141
- # ํŒŒ์ผ ์—…๋กœ๋“œ ์ฒ˜๋ฆฌ ํ•จ์ˆ˜
142
- def upload_and_analyze():
143
- uploaded_file = st.file_uploader("ํ…์ŠคํŠธ ํŒŒ์ผ ์—…๋กœ๋“œ", type=["txt"])
144
- if uploaded_file is not None:
145
- # ํŒŒ์ผ ๋‚ด์šฉ ์ฝ๊ธฐ
146
- raw_text = uploaded_file.getvalue().decode("utf-8")
147
-
148
- # ์˜ˆ์ธก ๋ฐ ์‹œ๊ฐํ™”
149
- html_output = predict_and_plot(raw_text)
150
-
151
- # ์ถœ๋ ฅ ๊ฒฐ๊ณผ๋ฅผ HTML๋กœ ๋ณด์—ฌ์ฃผ๊ธฐ
152
- st.markdown(html_output, unsafe_allow_html=True)
153
-
154
- # Streamlit ์•ฑ ์‹คํ–‰
155
- if __name__ == "__main__":
156
- st.title("๊ฐ์ • ๋ถ„์„๊ธฐ")
157
- st.write("ํ…์ŠคํŠธ ํŒŒ์ผ์„ ์—…๋กœ๋“œํ•˜์—ฌ ๊ฐ์ • ๋ถ„์„์„ ํ•ด๋ณด์„ธ์š”.")
158
- upload_and_analyze()
 
10
  from collections import defaultdict
11
  import base64
12
  from io import BytesIO
 
13
 
14
  # ํฐํŠธ ์„ค์ •
15
  font_path = './NanumGothic.ttf'
 
135
  else:
136
  html_output += "<p>โš ๏ธ ์‹œ๊ฐํ™”ํ•  ์ˆ˜ ์žˆ๋Š” ๊ฐ์ •์ด ์—†์Šต๋‹ˆ๋‹ค.</p><hr/>"
137
 
138
+ return html_output