Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -25,12 +25,13 @@ def process_excel(file):
|
|
25 |
# 결과를 데이터프레임으로 변환
|
26 |
result_df = pd.DataFrame(keyword_count.items(), columns=['키워드', '빈도']).sort_values(by='빈도', ascending=False).reset_index(drop=True)
|
27 |
|
28 |
-
# A4와 B4 셀부터 데이터가 들어가도록
|
29 |
-
|
30 |
-
|
|
|
31 |
|
32 |
# 워크북 및 시트 가져오기
|
33 |
-
workbook =
|
34 |
sheet = writer.sheets['Sheet1']
|
35 |
|
36 |
# 차트 생성
|
@@ -45,8 +46,8 @@ def process_excel(file):
|
|
45 |
|
46 |
# 차트를 시트에 추가
|
47 |
sheet.add_chart(chart, "E4") # E4 셀에 차트를 추가
|
48 |
-
|
49 |
-
return
|
50 |
|
51 |
# Gradio 인터페이스 생성
|
52 |
interface = gr.Interface(
|
@@ -56,4 +57,4 @@ interface = gr.Interface(
|
|
56 |
)
|
57 |
|
58 |
if __name__ == "__main__":
|
59 |
-
interface.launch()
|
|
|
25 |
# 결과를 데이터프레임으로 변환
|
26 |
result_df = pd.DataFrame(keyword_count.items(), columns=['키워드', '빈도']).sort_values(by='빈도', ascending=False).reset_index(drop=True)
|
27 |
|
28 |
+
# A4와 B4 셀부터 데이터가 들어가도록 엑셀에 작성
|
29 |
+
output_file = 'keyword_result.xlsx'
|
30 |
+
with pd.ExcelWriter(output_file, engine='openpyxl') as writer:
|
31 |
+
result_df.to_excel(writer, index=False, startrow=3, startcol=0, sheet_name="Sheet1") # A4 셀에 해당하는 3번째 행, 0번째 열부터 시작
|
32 |
|
33 |
# 워크북 및 시트 가져오기
|
34 |
+
workbook = writer.book
|
35 |
sheet = writer.sheets['Sheet1']
|
36 |
|
37 |
# 차트 생성
|
|
|
46 |
|
47 |
# 차트를 시트에 추가
|
48 |
sheet.add_chart(chart, "E4") # E4 셀에 차트를 추가
|
49 |
+
|
50 |
+
return output_file
|
51 |
|
52 |
# Gradio 인터페이스 생성
|
53 |
interface = gr.Interface(
|
|
|
57 |
)
|
58 |
|
59 |
if __name__ == "__main__":
|
60 |
+
interface.launch()
|