Update app.py
Browse files
app.py
CHANGED
|
@@ -50,13 +50,13 @@ def analyze_reviews(file_path):
|
|
| 50 |
plt.close()
|
| 51 |
logger.info("κ·Έλν μμ± μλ£")
|
| 52 |
|
| 53 |
-
# μλ‘μ΄ μνΈμ κ·Έλν
|
| 54 |
logger.info("μλ‘μ΄ μνΈ μμ± μμ")
|
| 55 |
with pd.ExcelWriter(file_path, engine='openpyxl', mode='a') as writer:
|
| 56 |
-
monthly_review_counts.to_excel(writer, sheet_name='
|
| 57 |
logger.info("μλ‘μ΄ μνΈ μμ± μλ£")
|
| 58 |
|
| 59 |
-
return
|
| 60 |
except Exception as e:
|
| 61 |
logger.error(f"λΆμ μ€ μ€λ₯ λ°μ: {e}")
|
| 62 |
return None
|
|
@@ -68,10 +68,10 @@ def main():
|
|
| 68 |
gr.Markdown("### 리뷰 λΆμ μ€νμ΄μ€")
|
| 69 |
with gr.Row():
|
| 70 |
file_input = gr.File(label="μλ³Έ μμ
νμΌ μ
λ‘λ", file_types=[".xlsx"])
|
| 71 |
-
|
| 72 |
analyze_button = gr.Button("λΆμ")
|
| 73 |
|
| 74 |
-
analyze_button.click(fn=analyze_reviews, inputs=file_input, outputs=
|
| 75 |
|
| 76 |
demo.launch()
|
| 77 |
|
|
|
|
| 50 |
plt.close()
|
| 51 |
logger.info("κ·Έλν μμ± μλ£")
|
| 52 |
|
| 53 |
+
# μλ‘μ΄ μνΈμ κ·Έλν μ μ₯
|
| 54 |
logger.info("μλ‘μ΄ μνΈ μμ± μμ")
|
| 55 |
with pd.ExcelWriter(file_path, engine='openpyxl', mode='a') as writer:
|
| 56 |
+
monthly_review_counts.to_excel(writer, sheet_name='μλ³κ·Έλν', index=False)
|
| 57 |
logger.info("μλ‘μ΄ μνΈ μμ± μλ£")
|
| 58 |
|
| 59 |
+
return file_path
|
| 60 |
except Exception as e:
|
| 61 |
logger.error(f"λΆμ μ€ μ€λ₯ λ°μ: {e}")
|
| 62 |
return None
|
|
|
|
| 68 |
gr.Markdown("### 리뷰 λΆμ μ€νμ΄μ€")
|
| 69 |
with gr.Row():
|
| 70 |
file_input = gr.File(label="μλ³Έ μμ
νμΌ μ
λ‘λ", file_types=[".xlsx"])
|
| 71 |
+
file_output = gr.File(label="λΆμλ μμ
νμΌ λ€μ΄λ‘λ", type="filepath")
|
| 72 |
analyze_button = gr.Button("λΆμ")
|
| 73 |
|
| 74 |
+
analyze_button.click(fn=analyze_reviews, inputs=file_input, outputs=file_output)
|
| 75 |
|
| 76 |
demo.launch()
|
| 77 |
|