soojeongcrystal commited on
Commit
4844289
·
verified ·
1 Parent(s): 0f3d973

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -14
app.py CHANGED
@@ -87,13 +87,22 @@ def create_custom_network_html(G):
87
  shape: 'dot',
88
  size: 20,
89
  font: {{
90
- size: 15,
91
- color: '#000000'
 
92
  }},
93
  borderWidth: 2
94
  }},
95
  edges: {{
96
  width: 1
 
 
 
 
 
 
 
 
97
  }}
98
  }};
99
  var network = new vis.Network(container, data, options);
@@ -119,13 +128,16 @@ st.markdown("""
119
  padding: 10px;
120
  margin-bottom: 10px;
121
  }
 
 
 
122
  </style>
123
  <div style="background-color: #f1f1f1; padding: 10px; color: #707070; text-align: right; width: 100%;">
124
  mySUNI 행복 College 행복담당조직 Meet-Up
125
  </div>
126
  """, unsafe_allow_html=True)
127
 
128
- st.title('📊토픽모델링 for SK')
129
 
130
  # 사이드바 설정
131
  with st.sidebar:
@@ -146,7 +158,19 @@ with st.sidebar:
146
  # 파일 업로드
147
  uploaded_file = st.file_uploader("CSV 파일을 업로드하세요", type="csv")
148
 
149
- # 파일 미리보기 분석 실행 (본문에서)
 
 
 
 
 
 
 
 
 
 
 
 
150
  if uploaded_file is not None:
151
  try:
152
  df = pd.read_csv(uploaded_file)
@@ -156,13 +180,6 @@ if uploaded_file is not None:
156
  st.success("파일이 성공적으로 업로드되었습니다.")
157
  st.subheader("데이터 미리보기")
158
  st.write(df.head())
159
-
160
- text_column = st.selectbox("텍스트 컬럼을 선택하세요", df.columns)
161
- num_topics = st.slider("토픽 수를 선택하세요", 2, 20, 5)
162
- if st.button("토픽 모델링 실행"):
163
- st.session_state.run_analysis = True
164
- else:
165
- st.session_state.run_analysis = False
166
  except Exception as e:
167
  st.error(f"파일을 읽는 중 오류가 발생했습니다: {str(e)}")
168
 
@@ -324,8 +341,8 @@ if 'run_analysis' in st.session_state and st.session_state.run_analysis:
324
 
325
  try:
326
  response = client.completions.create(
327
- model="claude-3-sonnet-20240229",
328
- max_tokens=3000,
329
  prompt=prompt
330
  )
331
  st.subheader("토픽 모델링 종합 결과")
@@ -344,4 +361,5 @@ if 'run_analysis' in st.session_state and st.session_state.run_analysis:
344
  st.markdown("""
345
  ---
346
  © 2024 SK mySUNI 행복 College. All rights reserved. 문의사항이 있으시면 연락주세요 (배수정RF, soojeong.bae@sk.com)
347
- """)
 
 
87
  shape: 'dot',
88
  size: 20,
89
  font: {{
90
+ size: 12,
91
+ color: '#000000',
92
+ face: 'arial'
93
  }},
94
  borderWidth: 2
95
  }},
96
  edges: {{
97
  width: 1
98
+ }},
99
+ physics: {{
100
+ stabilization: false,
101
+ barnesHut: {{
102
+ gravitationalConstant: -5000,
103
+ springConstant: 0.01,
104
+ springLength: 200
105
+ }}
106
  }}
107
  }};
108
  var network = new vis.Network(container, data, options);
 
128
  padding: 10px;
129
  margin-bottom: 10px;
130
  }
131
+ .small-title {
132
+ font-size: 24px;
133
+ }
134
  </style>
135
  <div style="background-color: #f1f1f1; padding: 10px; color: #707070; text-align: right; width: 100%;">
136
  mySUNI 행복 College 행복담당조직 Meet-Up
137
  </div>
138
  """, unsafe_allow_html=True)
139
 
140
+ st.markdown('<h1 class="small-title">📊토픽모델링 for SK</h1>', unsafe_allow_html=True)
141
 
142
  # 사이드바 설정
143
  with st.sidebar:
 
158
  # 파일 업로드
159
  uploaded_file = st.file_uploader("CSV 파일을 업로드하세요", type="csv")
160
 
161
+ if uploaded_file is not None:
162
+ try:
163
+ df = pd.read_csv(uploaded_file)
164
+ text_column = st.selectbox("텍스트 컬럼을 선택하세요", df.columns)
165
+ num_topics = st.slider("토픽 수를 선택하세요", 2, 20, 5)
166
+ if st.button("토픽 모델링 실행"):
167
+ st.session_state.run_analysis = True
168
+ else:
169
+ st.session_state.run_analysis = False
170
+ except Exception as e:
171
+ st.error(f"파일을 읽는 중 오류가 발생했습니다: {str(e)}")
172
+
173
+ # 파일 미리보기 (본문에서)
174
  if uploaded_file is not None:
175
  try:
176
  df = pd.read_csv(uploaded_file)
 
180
  st.success("파일이 성공적으로 업로드되었습니다.")
181
  st.subheader("데이터 미리보기")
182
  st.write(df.head())
 
 
 
 
 
 
 
183
  except Exception as e:
184
  st.error(f"파일을 읽는 중 오류가 발생했습니다: {str(e)}")
185
 
 
341
 
342
  try:
343
  response = client.completions.create(
344
+ model="claude-2.1",
345
+ max_tokens_to_sample=3000,
346
  prompt=prompt
347
  )
348
  st.subheader("토픽 모델링 종합 결과")
 
361
  st.markdown("""
362
  ---
363
  © 2024 SK mySUNI 행복 College. All rights reserved. 문의사항이 있으시면 연락주세요 (배수정RF, soojeong.bae@sk.com)
364
+ """)
365
+