Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,22 +6,23 @@ import networkx as nx
|
|
| 6 |
import matplotlib.pyplot as plt
|
| 7 |
import csv
|
| 8 |
import io
|
|
|
|
| 9 |
|
| 10 |
# Sentence-BERT ๋ชจ๋ธ ๋ก๋
|
| 11 |
model = SentenceTransformer('all-MiniLM-L6-v2')
|
| 12 |
|
| 13 |
-
# ์ถ์ฒ ๊ฒฐ๊ณผ๋ฅผ
|
| 14 |
-
def
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
|
|
|
| 22 |
|
| 23 |
-
|
| 24 |
-
return output.getvalue()
|
| 25 |
|
| 26 |
# ์๋์ผ๋ก ์ด์ ๋งค์นญํ๋ ํจ์
|
| 27 |
def auto_match_columns(df, required_cols):
|
|
@@ -104,12 +105,13 @@ def analyze_data(employee_file, program_file):
|
|
| 104 |
plt.title("์ง์๊ณผ ํ๋ก๊ทธ๋จ ๊ฐ์ ๊ด๊ณ", fontsize=14, fontweight='bold')
|
| 105 |
plt.tight_layout()
|
| 106 |
|
| 107 |
-
|
|
|
|
| 108 |
|
| 109 |
return "\n".join(recommendations), plt.gcf(), csv_output
|
| 110 |
|
| 111 |
# Gradio ๋ธ๋ก
|
| 112 |
-
with gr.Blocks(css=".gradio-button {background-color: #
|
| 113 |
gr.Markdown("<h1 style='text-align: center; color: #2c3e50;'>๐ผ HybridRAG ์์คํ
</h1>")
|
| 114 |
|
| 115 |
with gr.Row():
|
|
|
|
| 6 |
import matplotlib.pyplot as plt
|
| 7 |
import csv
|
| 8 |
import io
|
| 9 |
+
import os
|
| 10 |
|
| 11 |
# Sentence-BERT ๋ชจ๋ธ ๋ก๋
|
| 12 |
model = SentenceTransformer('all-MiniLM-L6-v2')
|
| 13 |
|
| 14 |
+
# ์ถ์ฒ ๊ฒฐ๊ณผ๋ฅผ ์ค์ ํ์ผ๋ก ์ ์ฅํ๋ ํจ์
|
| 15 |
+
def save_recommendations_to_file(recommendations):
|
| 16 |
+
file_path = "recommendations.csv"
|
| 17 |
+
with open(file_path, mode='w', newline='', encoding='utf-8') as file:
|
| 18 |
+
writer = csv.writer(file)
|
| 19 |
+
writer.writerow(["Employee ID", "Employee Name", "Recommended Programs"])
|
| 20 |
+
|
| 21 |
+
# ์ถ์ฒ ๊ฒฐ๊ณผ CSV ํ์ผ์ ๊ธฐ๋ก
|
| 22 |
+
for rec in recommendations:
|
| 23 |
+
writer.writerow(rec)
|
| 24 |
|
| 25 |
+
return file_path
|
|
|
|
| 26 |
|
| 27 |
# ์๋์ผ๋ก ์ด์ ๋งค์นญํ๋ ํจ์
|
| 28 |
def auto_match_columns(df, required_cols):
|
|
|
|
| 105 |
plt.title("์ง์๊ณผ ํ๋ก๊ทธ๋จ ๊ฐ์ ๊ด๊ณ", fontsize=14, fontweight='bold')
|
| 106 |
plt.tight_layout()
|
| 107 |
|
| 108 |
+
# CSV ํ์ผ๋ก ์ถ์ฒ ๊ฒฐ๊ณผ ๋ฐํ
|
| 109 |
+
csv_output = save_recommendations_to_file(recommendation_rows)
|
| 110 |
|
| 111 |
return "\n".join(recommendations), plt.gcf(), csv_output
|
| 112 |
|
| 113 |
# Gradio ๋ธ๋ก
|
| 114 |
+
with gr.Blocks(css=".gradio-button {background-color: #007bff; color: white;} .gradio-textbox {border-color: #6c757d;}") as demo:
|
| 115 |
gr.Markdown("<h1 style='text-align: center; color: #2c3e50;'>๐ผ HybridRAG ์์คํ
</h1>")
|
| 116 |
|
| 117 |
with gr.Row():
|