Spaces:
Sleeping
Sleeping
Commit
Β·
f6a2a35
1
Parent(s):
498e0ad
add
Browse files
app.py
CHANGED
@@ -45,10 +45,20 @@ def main():
|
|
45 |
user_input = st.chat_input("λ©μμ§λ₯Ό μ
λ ₯νμΈμ...")
|
46 |
|
47 |
if user_input:
|
48 |
-
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
bot_text = response[0]["generated_text"]
|
51 |
|
|
|
|
|
|
|
52 |
# μΈμ
μ€ν
μ΄νΈμ λν λ΄μ© μ
λ°μ΄νΈ
|
53 |
st.session_state["past_user_inputs"].append(user_input)
|
54 |
st.session_state["generated_responses"].append(bot_text)
|
|
|
45 |
user_input = st.chat_input("λ©μμ§λ₯Ό μ
λ ₯νμΈμ...")
|
46 |
|
47 |
if user_input:
|
48 |
+
# μ¬μ©μ λ©μμ§ νμ
|
49 |
+
with st.chat_message("user"):
|
50 |
+
st.write(user_input)
|
51 |
+
|
52 |
+
# ν둬ννΈ μμ±
|
53 |
+
prompt = f"Human: {user_input}\n\nAssistant:"
|
54 |
+
|
55 |
+
# λͺ¨λΈ μμ±
|
56 |
+
response = pipe(prompt, max_length=2048, temperature=0.7, do_sample=True)
|
57 |
bot_text = response[0]["generated_text"]
|
58 |
|
59 |
+
# Assistant μλ΅λ§ μΆμΆ
|
60 |
+
bot_text = bot_text.split("Assistant:")[-1].strip()
|
61 |
+
|
62 |
# μΈμ
μ€ν
μ΄νΈμ λν λ΄μ© μ
λ°μ΄νΈ
|
63 |
st.session_state["past_user_inputs"].append(user_input)
|
64 |
st.session_state["generated_responses"].append(bot_text)
|