Update app.py
Browse files
app.py
CHANGED
|
@@ -24,12 +24,13 @@ model = genai.GenerativeModel(
|
|
| 24 |
generation_config=generation_config,
|
| 25 |
)
|
| 26 |
|
| 27 |
-
def generate_pairing_recommendation(input_text, input_type):
|
| 28 |
"""
|
| 29 |
입력받은 안주 또는 주류에 어울리는 페어링 정보를 생성합니다.
|
| 30 |
Args:
|
| 31 |
input_text (str): 안주 또는 주류 정보
|
| 32 |
input_type (str): 입력 종류 ('안주' 또는 '주류')
|
|
|
|
| 33 |
Returns:
|
| 34 |
str: 생성된 페어링 정보
|
| 35 |
"""
|
|
@@ -38,6 +39,7 @@ def generate_pairing_recommendation(input_text, input_type):
|
|
| 38 |
당신은 주류 페어링 전문가입니다.
|
| 39 |
사용자가 안주 또는 주류를 입력하면, 해당 안주에 어울리는 주류 또는 해당 주류에 어울리는 안주를 구체적으로 설명해주세요. 또한 각각의 특징, 맛, 향, 그리고 추천 이유를 포함하여 상세하게 작성해주세요.
|
| 40 |
한국인의 취향에 맞는 주류나 안주를 추천해주세요. 추천 점수를 10점 만점으로 표현해주세요. 주류나 안주 추천은 종류별로 다양하게 해주세요.
|
|
|
|
| 41 |
다음은 페어링 추천에 필요한 정보입니다.
|
| 42 |
**페어링 구성 요소:**
|
| 43 |
1. 추천 주류/안주 소개
|
|
@@ -51,6 +53,7 @@ def generate_pairing_recommendation(input_text, input_type):
|
|
| 51 |
SYSTEM_PROMPT,
|
| 52 |
f"**입력 종류:** {input_type}",
|
| 53 |
f"**입력 내용:** {input_text}",
|
|
|
|
| 54 |
"**추천 페어링:**",
|
| 55 |
]
|
| 56 |
|
|
@@ -83,15 +86,19 @@ tabs = st.tabs(["🍝 안주 입력", "🍇 주류 입력"])
|
|
| 83 |
|
| 84 |
with tabs[0]:
|
| 85 |
st.markdown("#### 안주를 입력해 주세요:")
|
| 86 |
-
input_text_anjoo = st.text_area("예: 치킨, 육회, 치즈 플래터 등", height=
|
| 87 |
|
| 88 |
with tabs[1]:
|
| 89 |
st.markdown("#### 주류를 입력해 주세요:")
|
| 90 |
-
input_text_liquor = st.text_area("예: 맥주, 와인, 소주 등", height=
|
| 91 |
|
| 92 |
input_type = "안주" if input_text_anjoo else "주류"
|
| 93 |
input_text = input_text_anjoo if input_text_anjoo else input_text_liquor
|
| 94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
generate_button = st.button("🍻 페어링 추천 받기")
|
| 96 |
|
| 97 |
# 출력 영역 정의
|
|
@@ -103,7 +110,7 @@ if generate_button and input_text:
|
|
| 103 |
output_area.markdown(output_text)
|
| 104 |
try:
|
| 105 |
with st.spinner("페어링 정보를 생성 중입니다... 잠시만 기다려 주세요!"):
|
| 106 |
-
for partial_output in generate_pairing_recommendation(input_text, input_type):
|
| 107 |
output_text = partial_output
|
| 108 |
output_area.markdown(output_text)
|
| 109 |
except Exception as e:
|
|
|
|
| 24 |
generation_config=generation_config,
|
| 25 |
)
|
| 26 |
|
| 27 |
+
def generate_pairing_recommendation(input_text, input_type, situation):
|
| 28 |
"""
|
| 29 |
입력받은 안주 또는 주류에 어울리는 페어링 정보를 생성합니다.
|
| 30 |
Args:
|
| 31 |
input_text (str): 안주 또는 주류 정보
|
| 32 |
input_type (str): 입력 종류 ('안주' 또는 '주류')
|
| 33 |
+
situation (str): 상황 또는 분위기 정보
|
| 34 |
Returns:
|
| 35 |
str: 생성된 페어링 정보
|
| 36 |
"""
|
|
|
|
| 39 |
당신은 주류 페어링 전문가입니다.
|
| 40 |
사용자가 안주 또는 주류를 입력하면, 해당 안주에 어울리는 주류 또는 해당 주류에 어울리는 안주를 구체적으로 설명해주세요. 또한 각각의 특징, 맛, 향, 그리고 추천 이유를 포함하여 상세하게 작성해주세요.
|
| 41 |
한국인의 취향에 맞는 주류나 안주를 추천해주세요. 추천 점수를 10점 만점으로 표현해주세요. 주류나 안주 추천은 종류별로 다양하게 해주세요.
|
| 42 |
+
상황이나 분위기 정보를 고려하여 최적의 페어링을 추천해주세요.
|
| 43 |
다음은 페어링 추천에 필요한 정보입니다.
|
| 44 |
**페어링 구성 요소:**
|
| 45 |
1. 추천 주류/안주 소개
|
|
|
|
| 53 |
SYSTEM_PROMPT,
|
| 54 |
f"**입력 종류:** {input_type}",
|
| 55 |
f"**입력 내용:** {input_text}",
|
| 56 |
+
f"**상황/분위기:** {situation}",
|
| 57 |
"**추천 페어링:**",
|
| 58 |
]
|
| 59 |
|
|
|
|
| 86 |
|
| 87 |
with tabs[0]:
|
| 88 |
st.markdown("#### 안주를 입력해 주세요:")
|
| 89 |
+
input_text_anjoo = st.text_area("예: 치킨, 육회, 치즈 플래터 등", height=50)
|
| 90 |
|
| 91 |
with tabs[1]:
|
| 92 |
st.markdown("#### 주류를 입력해 주세요:")
|
| 93 |
+
input_text_liquor = st.text_area("예: 맥주, 와인, 소주 등", height=50)
|
| 94 |
|
| 95 |
input_type = "안주" if input_text_anjoo else "주류"
|
| 96 |
input_text = input_text_anjoo if input_text_anjoo else input_text_liquor
|
| 97 |
|
| 98 |
+
# 상황 또는 분위기 입력
|
| 99 |
+
st.markdown("#### 상황이나 분위기를 입력해 주세요:")
|
| 100 |
+
situation = st.text_area("예: 친구들과의 모임, 로맨틱한 데이트, 가족과의 저녁 식사 등", height=100)
|
| 101 |
+
|
| 102 |
generate_button = st.button("🍻 페어링 추천 받기")
|
| 103 |
|
| 104 |
# 출력 영역 정의
|
|
|
|
| 110 |
output_area.markdown(output_text)
|
| 111 |
try:
|
| 112 |
with st.spinner("페어링 정보를 생성 중입니다... 잠시만 기다려 주세요!"):
|
| 113 |
+
for partial_output in generate_pairing_recommendation(input_text, input_type, situation):
|
| 114 |
output_text = partial_output
|
| 115 |
output_area.markdown(output_text)
|
| 116 |
except Exception as e:
|