Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,8 @@ import pandas as pd
|
|
3 |
import re
|
4 |
from collections import Counter
|
5 |
import os
|
|
|
|
|
6 |
|
7 |
def process_excel(file):
|
8 |
# μμ
νμΌ μ½κΈ°
|
@@ -39,6 +41,17 @@ def process_excel(file):
|
|
39 |
with pd.ExcelWriter(output_file, engine='openpyxl') as writer:
|
40 |
result_df.to_excel(writer, index=False, startrow=3) # startrow=3μΌλ‘ μ€μ νμ¬ 4λ²μ§Έ ν(A4, B4)λΆν° μμ
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
return output_file
|
43 |
|
44 |
# Gradio μΈν°νμ΄μ€ μ μ
|
@@ -46,8 +59,8 @@ iface = gr.Interface(
|
|
46 |
fn=process_excel,
|
47 |
inputs=gr.File(file_types=[".xlsx"]), # μμ
νμΌλ§ μ
λ‘λν μ μκ² μ€μ
|
48 |
outputs="file",
|
49 |
-
title="Excel Keyword Extractor",
|
50 |
-
description="μμ
νμΌμ Dμ΄μμ ν€μλλ₯Ό μΆμΆνκ³ λΉλλ₯Ό
|
51 |
)
|
52 |
|
53 |
if __name__ == "__main__":
|
|
|
3 |
import re
|
4 |
from collections import Counter
|
5 |
import os
|
6 |
+
from openpyxl import load_workbook
|
7 |
+
from openpyxl.drawing.image import Image
|
8 |
|
9 |
def process_excel(file):
|
10 |
# μμ
νμΌ μ½κΈ°
|
|
|
41 |
with pd.ExcelWriter(output_file, engine='openpyxl') as writer:
|
42 |
result_df.to_excel(writer, index=False, startrow=3) # startrow=3μΌλ‘ μ€μ νμ¬ 4λ²μ§Έ ν(A4, B4)λΆν° μμ
|
43 |
|
44 |
+
# μ΄λ―Έμ§λ₯Ό μμ
νμΌμ A1 μ
μ μ½μ
|
45 |
+
wb = load_workbook(output_file)
|
46 |
+
ws = wb.active
|
47 |
+
|
48 |
+
# ssboost-logo.png νμΌμ A1 μ
μ μ½μ
|
49 |
+
img = Image("ssboost-logo.png")
|
50 |
+
ws.add_image(img, "A1")
|
51 |
+
|
52 |
+
# μμ λ μμ
νμΌ μ μ₯
|
53 |
+
wb.save(output_file)
|
54 |
+
|
55 |
return output_file
|
56 |
|
57 |
# Gradio μΈν°νμ΄μ€ μ μ
|
|
|
59 |
fn=process_excel,
|
60 |
inputs=gr.File(file_types=[".xlsx"]), # μμ
νμΌλ§ μ
λ‘λν μ μκ² μ€μ
|
61 |
outputs="file",
|
62 |
+
title="Excel Keyword Extractor with Image",
|
63 |
+
description="μμ
νμΌμ Dμ΄μμ ν€μλλ₯Ό μΆμΆνκ³ λΉλλ₯Ό κ³μ°ν ν, A1 μ
μ μ΄λ―Έμ§λ₯Ό μ½μ
νμ¬ μλ‘μ΄ μμ
νμΌλ‘ μΆλ ₯ν©λλ€."
|
64 |
)
|
65 |
|
66 |
if __name__ == "__main__":
|