beta v0.98
Browse filessome small UI fix
- app.py +16 -6
- savedata.db +0 -0
app.py
CHANGED
@@ -287,7 +287,9 @@ z_mapping = {
|
|
287 |
}
|
288 |
|
289 |
## AI 建議
|
290 |
-
def get_advice(API_KEY, model="gpt-3.5-turbo-16k"):
|
|
|
|
|
291 |
if API_KEY:
|
292 |
openai.api_key = API_KEY
|
293 |
else:
|
@@ -308,6 +310,11 @@ def get_advice(API_KEY, model="gpt-3.5-turbo-16k"):
|
|
308 |
myData = json.load(json_file)
|
309 |
# 現在,myData 變數包含了 JSON 檔案的內容
|
310 |
|
|
|
|
|
|
|
|
|
|
|
311 |
|
312 |
def get_data(star_name): ##
|
313 |
msum = ''
|
@@ -371,7 +378,7 @@ def get_advice(API_KEY, model="gpt-3.5-turbo-16k"):
|
|
371 |
# {"role": "user", "content": f'我的人格特質以紫微斗數星象來推論是“{gw_main_star}”. 請替我依照這些人格特質,並根據 Myers-Briggs Type Indicator (MBTI) 人格分析學說,一條一條的幫我解析?'},]
|
372 |
# {"role": "user", "content": f'我的人格特質以紫微斗數星象來推論是“{gw_main_star}”. 請替我依照這些人格特質,並根據 16 Personality Factors 人格分析工具,一條一條的幫我分析?'},]
|
373 |
# {"role": "user", "content": f'我的人格特質以紫微斗數星象來推論是“{gw_main_star}”. 請替我依照這些人格特質,並根據 OCEAN 五大人格分析系統,一條一條的幫我分析?'},]
|
374 |
-
{"role": "user", "content": f'
|
375 |
# OCEAN 五大人格特質
|
376 |
response = openai.chat.completions.create(
|
377 |
model=model,
|
@@ -384,6 +391,7 @@ def get_advice(API_KEY, model="gpt-3.5-turbo-16k"):
|
|
384 |
ming_feedback.info = 'YES'
|
385 |
ming_feedback.value = returndata
|
386 |
|
|
|
387 |
return returndata
|
388 |
|
389 |
def GWAI(year, month, day, btime, sex) -> datetime:
|
@@ -391,6 +399,7 @@ def GWAI(year, month, day, btime, sex) -> datetime:
|
|
391 |
date_lunar = ZhDate.from_datetime(dt_date1)
|
392 |
bstr = str(date_lunar)
|
393 |
|
|
|
394 |
# 發現有用戶會在時間輸入時,輸進全型的分號
|
395 |
if ':' in btime:
|
396 |
hour = int(btime.split(":")[0])
|
@@ -424,6 +433,7 @@ def GWAI(year, month, day, btime, sex) -> datetime:
|
|
424 |
if sex == '男' or sex == '男生' or sex == 'Male' or sex == 'male' or sex == 'M' or sex == 'm' or sex == 'Boy' or sex == 'boy' or sex == '1':
|
425 |
pssex = 1
|
426 |
|
|
|
427 |
print(output)
|
428 |
print('<<',my_year,my_month,my_day,pssex,'>>')
|
429 |
output2=gen_chart(int(my_year), int(my_month), int(my_day), hour, int(30), int(pssex))
|
@@ -500,17 +510,17 @@ def save_feedback(x,savedata):
|
|
500 |
# 建立 components
|
501 |
year = gr.Textbox(
|
502 |
label="生年",
|
503 |
-
info="輸入你的西元出生年份",
|
504 |
placeholder="Input your birth year here...")
|
505 |
|
506 |
month = gr.Textbox(
|
507 |
label="生月",
|
508 |
-
info="輸入你的出生月份",
|
509 |
placeholder="Input your birthday month here...",)
|
510 |
|
511 |
day = gr.Textbox(
|
512 |
label="生日",
|
513 |
-
info="輸入你的出生日子",
|
514 |
placeholder="Input your birthday day here...",)
|
515 |
|
516 |
btime = gr.Textbox(
|
@@ -520,7 +530,7 @@ btime = gr.Textbox(
|
|
520 |
|
521 |
sex = gr.Textbox(
|
522 |
label="性別",
|
523 |
-
info="
|
524 |
placeholder="Input you are male or female here...",)
|
525 |
|
526 |
output_gwai = gr.Textbox(
|
|
|
287 |
}
|
288 |
|
289 |
## AI 建議
|
290 |
+
## def get_advice(API_KEY, model="gpt-3.5-turbo-16k"):
|
291 |
+
def get_advice(API_KEY, model="gpt-4-turbo-preview"):
|
292 |
+
|
293 |
if API_KEY:
|
294 |
openai.api_key = API_KEY
|
295 |
else:
|
|
|
310 |
myData = json.load(json_file)
|
311 |
# 現在,myData 變數包含了 JSON 檔案的內容
|
312 |
|
313 |
+
# 處理性別
|
314 |
+
global gender
|
315 |
+
pssex = '男'
|
316 |
+
if gender == 2:
|
317 |
+
pssex = '女'
|
318 |
|
319 |
def get_data(star_name): ##
|
320 |
msum = ''
|
|
|
378 |
# {"role": "user", "content": f'我的人格特質以紫微斗數星象來推論是“{gw_main_star}”. 請替我依照這些人格特質,並根據 Myers-Briggs Type Indicator (MBTI) 人格分析學說,一條一條的幫我解析?'},]
|
379 |
# {"role": "user", "content": f'我的人格特質以紫微斗數星象來推論是“{gw_main_star}”. 請替我依照這些人格特質,並根據 16 Personality Factors 人格分析工具,一條一條的幫我分析?'},]
|
380 |
# {"role": "user", "content": f'我的人格特質以紫微斗數星象來推論是“{gw_main_star}”. 請替我依照這些人格特質,並根據 OCEAN 五大人格分析系統,一條一條的幫我分析?'},]
|
381 |
+
{"role": "user", "content": f'此用戶是{pssex}性,依據生辰推測的人格特質是“{gw_main_star}“。\n\n請給他一些待人處事的建議?'},]
|
382 |
# OCEAN 五大人格特質
|
383 |
response = openai.chat.completions.create(
|
384 |
model=model,
|
|
|
391 |
ming_feedback.info = 'YES'
|
392 |
ming_feedback.value = returndata
|
393 |
|
394 |
+
print(f'此用戶是{pssex}性,人格特質是“{gw_main_star}“。請給他一些跟性別相關的待人處事的建議?')
|
395 |
return returndata
|
396 |
|
397 |
def GWAI(year, month, day, btime, sex) -> datetime:
|
|
|
399 |
date_lunar = ZhDate.from_datetime(dt_date1)
|
400 |
bstr = str(date_lunar)
|
401 |
|
402 |
+
global gender
|
403 |
# 發現有用戶會在時間輸入時,輸進全型的分號
|
404 |
if ':' in btime:
|
405 |
hour = int(btime.split(":")[0])
|
|
|
433 |
if sex == '男' or sex == '男生' or sex == 'Male' or sex == 'male' or sex == 'M' or sex == 'm' or sex == 'Boy' or sex == 'boy' or sex == '1':
|
434 |
pssex = 1
|
435 |
|
436 |
+
gender = pssex
|
437 |
print(output)
|
438 |
print('<<',my_year,my_month,my_day,pssex,'>>')
|
439 |
output2=gen_chart(int(my_year), int(my_month), int(my_day), hour, int(30), int(pssex))
|
|
|
510 |
# 建立 components
|
511 |
year = gr.Textbox(
|
512 |
label="生年",
|
513 |
+
info="輸入你的西元出生年份(1900-2024)",
|
514 |
placeholder="Input your birth year here...")
|
515 |
|
516 |
month = gr.Textbox(
|
517 |
label="生月",
|
518 |
+
info="輸入你的出生月份(1-12)",
|
519 |
placeholder="Input your birthday month here...",)
|
520 |
|
521 |
day = gr.Textbox(
|
522 |
label="生日",
|
523 |
+
info="輸入你的出生日子(1-30)",
|
524 |
placeholder="Input your birthday day here...",)
|
525 |
|
526 |
btime = gr.Textbox(
|
|
|
530 |
|
531 |
sex = gr.Textbox(
|
532 |
label="性別",
|
533 |
+
info="輸入你是男生(M)或女生(F)",
|
534 |
placeholder="Input you are male or female here...",)
|
535 |
|
536 |
output_gwai = gr.Textbox(
|
savedata.db
CHANGED
Binary files a/savedata.db and b/savedata.db differ
|
|