Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -16,18 +16,31 @@ def generate_topics(field, major, keywords, audience, level):
|
|
16 |
if not all([field.strip(), major.strip(), keywords.strip(), audience.strip()]):
|
17 |
return "<div style='color: red;'>❌ لطفاً همه فیلدها را پر کنید.</div>"
|
18 |
|
19 |
-
#
|
20 |
-
|
21 |
f"Suggest 3 academic thesis topics based on the following:\n"
|
22 |
f"Field: {field}\n"
|
23 |
f"Specialization: {major}\n"
|
24 |
f"Keywords: {keywords}\n"
|
25 |
f"Target Audience: {audience}\n"
|
26 |
-
f"Level: {level}"
|
27 |
)
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
try:
|
30 |
-
# فراخوانی مدل DeepSeek با
|
31 |
response = hf_client.chat.completions.create(
|
32 |
model="deepseek-ai/DeepSeek-Prover-V2-671B",
|
33 |
messages=[
|
|
|
16 |
if not all([field.strip(), major.strip(), keywords.strip(), audience.strip()]):
|
17 |
return "<div style='color: red;'>❌ لطفاً همه فیلدها را پر کنید.</div>"
|
18 |
|
19 |
+
# بخش مشترک پرامپت
|
20 |
+
base_prompt = (
|
21 |
f"Suggest 3 academic thesis topics based on the following:\n"
|
22 |
f"Field: {field}\n"
|
23 |
f"Specialization: {major}\n"
|
24 |
f"Keywords: {keywords}\n"
|
25 |
f"Target Audience: {audience}\n"
|
26 |
+
f"Level: {level}\n"
|
27 |
)
|
28 |
|
29 |
+
# اگر دکتری است، تاکید روی ارائه الگو و مدلسازی پیچیدهتر
|
30 |
+
if level == "دکتری":
|
31 |
+
extra = (
|
32 |
+
"Since this is a doctoral-level project, focus on proposing theoretical frameworks, "
|
33 |
+
"advanced modeling approaches, and in-depth methodological contributions."
|
34 |
+
)
|
35 |
+
else:
|
36 |
+
extra = (
|
37 |
+
"Focus on practical and applied thesis topics suitable for a master's level student."
|
38 |
+
)
|
39 |
+
|
40 |
+
prompt = base_prompt + extra
|
41 |
+
|
42 |
try:
|
43 |
+
# فراخوانی مدل DeepSeek با endpoint چت
|
44 |
response = hf_client.chat.completions.create(
|
45 |
model="deepseek-ai/DeepSeek-Prover-V2-671B",
|
46 |
messages=[
|