added excel content generator

This commit is contained in:
siavash32tm
2025-05-06 15:33:48 +02:00
parent 631013058e
commit f24ee7ec76
9 changed files with 618 additions and 206 deletions
+177
View File
@@ -0,0 +1,177 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 167,
"id": "df07eee0",
"metadata": {},
"outputs": [],
"source": [
"list_complete = ''\n",
"list_pending = ''\n",
"title = ''\n",
"perc = ('80', '40', '۸۰٪')\n",
"description = ''\n",
"comment = ''\n",
"link = ''\n",
"link_ref = ''\n",
"\n",
"def get_html(list_complete, list_pending, title, perc, description, comment, link, link_ref):\n",
"\n",
" completed_tasks = ''\n",
" for i in list_complete:\n",
" completed_tasks += '<li>' + i +'</li>'\n",
"\n",
" pending_task = ''\n",
" for i in list_pending:\n",
" pending_task += '<li>' + i +'</li>'\n",
"\n",
"\n",
"\n",
" html_1 = \"\"\"\n",
" <div class=\"col-md-6 col-lg-4\">\n",
" <div class=\"card project-card\">\n",
" <div class=\"card-body\">\n",
" <h5 class=\"h4 mb-3\">\"\"\"+ title + '</h5> <p class=\"card-text\">'\n",
"\n",
" html_1 += description\n",
" html_1 += ' </p><div class=\"container text-center justify-content: center\">وضعیت پیشرفت '\n",
" html_1 += '<div class=\"progress-container\"><div class=\"progress\" style=\"width:' + perc[0] + '%; padding-right: ' + perc[1] + '%;\">' +perc[2]\n",
" html_1 += '</div></div></div><p>'\n",
"\n",
" if len(completed_tasks)>0:\n",
" html_1 +='<ul style=\"list-style-type: \\'✅ \\' ;\">' + completed_tasks + '</ul>'\n",
"\n",
" if len(pending_task)>0:\n",
" html_1 +='<ul style=\"list-style-type: \\'⏳ \\' ;\">' + pending_task + '</ul>'\n",
" html_1 += '</p>'\n",
" if type(comment)==str:\n",
" html_1 += str(comment)\n",
"\n",
" if type(link)==str:\n",
" html_1 += '<a href=\"' + str(link) + '\">'\n",
" if type(link_ref)==str:\n",
" html_1 += '<p class=\"card-text\">' + str(link_ref) + '</p>'\n",
" else:\n",
" html_1 += '<p class=\"card-text\">آدرس</p>'\n",
" html_1 += '</a>'\n",
"\n",
" html_1 += \"\"\"</div></div></div> \n",
" <!-- Repeat for other projects -->\"\"\"\n",
" return html_1"
]
},
{
"cell_type": "code",
"execution_count": 189,
"id": "9377c1d5",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"csv_file_path = 'proj_data_ex.xlsx'\n",
"csv_file_path = 'distributed_ai.xlsx'\n",
"csv_file_path = 'questionner.xlsx'\n",
"\n",
"xls = pd.read_excel(csv_file_path, sheet_name=None, engine='openpyxl')\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 190,
"id": "40e3885d",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
" <div class=\"col-md-6 col-lg-4\">\n",
" <div class=\"card project-card\">\n",
" <div class=\"card-body\">\n",
" <h5 class=\"h4 mb-3\">مدل‌های پرسشگر</h5> <p class=\"card-text\">ساخت مدل‌هایی که تسهیل‌کر خلق ایده‌ی نو توسط کاربر هستند و نه اینکه خود مولد باشند. چگونه کاربر راهنمایی شود بدون اینکه مدل جهت‌دهی خاصی را به او بدهد؟ و چگونه در خلق گمانه‌ی نو میتواند موثر باشد؟ </p><div class=\"container text-center justify-content: center\">وضعیت پیشرفت <div class=\"progress-container\"><div class=\"progress\" style=\"width:10%; padding-right: 2%;\">۰٪</div></div></div><p><ul style=\"list-style-type: '⏳ ' ;\"><li>تولید داده‌ی پرسشگری</li><li>بازآموزش مدل</li><li>هدایت تقویتی</li></ul></p></div></div></div> \n",
" <!-- Repeat for other projects -->\n",
"\n",
" <div class=\"col-md-6 col-lg-4\">\n",
" <div class=\"card project-card\">\n",
" <div class=\"card-body\">\n",
" <h5 class=\"h4 mb-3\">طراحی رفتار پرسشگر</h5> <p class=\"card-text\">مدل‌های مولد عموماً در غالب پاسخگو طراحی و استفاده می‌شوند. این امر می‌تواند باعث محدودیت بر خلاقیت انسان در تولید محتوی نو و جدید شود. در این پروژه ما به دنبال طراحی رفتار‌های کاربر (مانند prompt engineering) با محوریت مدل پرسشگر در مقابل انسان پاسخگو هستیم. </p><div class=\"container text-center justify-content: center\">وضعیت پیشرفت <div class=\"progress-container\"><div class=\"progress\" style=\"width:100%; padding-right: 50%;\">۱۰۰٪</div></div></div><p><ul style=\"list-style-type: '✅ ' ;\"><li>مهندسی پرامپت روی مدل‌های زبانی برای تغییر رفتار مدل</li></ul></p><a href=\"https://github.com/siavashBigdeli/prompt_engineering_questioner\"><p class=\"card-text\">آدرس گیت هاب</p></a></div></div></div> \n",
" <!-- Repeat for other projects -->\n"
]
}
],
"source": [
"percentages = [('10', '2', '۰٪'),\n",
" ('15', '5', '۱۰٪'),\n",
" ('20', '10', '۲۰٪'),\n",
" ('30', '15', '۳۰٪'),\n",
" ('40', '20', '۴۰٪'),\n",
" ('50', '25', '۵۰٪'),\n",
" ('60', '30', '۶۰٪'),\n",
" ('70', '35', '۸۰٪'),\n",
" ('80', '40', '۸۰٪'),\n",
" ('90', '45', '۹۰٪'),\n",
" ('100', '50', '۱۰۰٪')]\n",
"for sheet_name, df in xls.items():\n",
" cols = df.columns\n",
" title = df[df.columns[0]][0]\n",
" description = df[df.columns[1]][0]\n",
" p = int(df[df.columns[2]][0])\n",
" perc = percentages[p]\n",
" list_complete = df[df.columns[3]].dropna()\n",
" list_pending = df[df.columns[4]].dropna()\n",
" comment = df[df.columns[5]].dropna()\n",
" link = df[df.columns[6]][0]\n",
" link_ref = df[df.columns[7]][0]\n",
"\n",
" h = get_html(list_complete, list_pending, title, perc, description, comment, link, link_ref)\n",
" print(h)\n",
"\n",
" "
]
},
{
"cell_type": "code",
"execution_count": 161,
"id": "8e08cbd6",
"metadata": {},
"outputs": [
{
"ename": "TypeError",
"evalue": "object of type 'numpy.float64' has no len()",
"output_type": "error",
"traceback": [
"\u001b[1;31m\u001b[0m",
"\u001b[1;31mTypeError\u001b[0mTraceback (most recent call last)",
"\u001b[1;32m~\\AppData\\Local\\Temp/ipykernel_37900/3929354373.py\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mlen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mlink\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[1;31mTypeError\u001b[0m: object of type 'numpy.float64' has no len()"
]
}
],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
}
},
"nbformat": 4,
"nbformat_minor": 5
}