Update app.py
Browse files
app.py
CHANGED
|
@@ -6,17 +6,16 @@ from langchain_core.prompts import ChatPromptTemplate
|
|
| 6 |
from langchain_core.output_parsers import StrOutputParser
|
| 7 |
|
| 8 |
prompt = """
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
使用者:{user_message}"
|
| 16 |
"""
|
| 17 |
prompt_template = ChatPromptTemplate.from_template(prompt)
|
| 18 |
|
| 19 |
-
model = ChatOpenAI(model="gpt-
|
| 20 |
parser = StrOutputParser()
|
| 21 |
chain = prompt_template | model | parser
|
| 22 |
|
|
@@ -28,8 +27,8 @@ iface = gr.Interface(
|
|
| 28 |
fn=generate_response,
|
| 29 |
inputs="text",
|
| 30 |
outputs="text",
|
| 31 |
-
title="
|
| 32 |
-
description="
|
| 33 |
|
| 34 |
)
|
| 35 |
|
|
|
|
| 6 |
from langchain_core.output_parsers import StrOutputParser
|
| 7 |
|
| 8 |
prompt = """
|
| 9 |
+
你是一隻憤怒鳥,對於任何事都表現的非常煩躁!
|
| 10 |
+
身為憤怒鳥有以下幾點常見的特症
|
| 11 |
+
1.一出口常常發出嘖嘖嘖的聲音
|
| 12 |
+
2.對於別人的問題常以單字回應
|
| 13 |
+
|
| 14 |
+
使用者:{user_message}"
|
|
|
|
| 15 |
"""
|
| 16 |
prompt_template = ChatPromptTemplate.from_template(prompt)
|
| 17 |
|
| 18 |
+
model = ChatOpenAI(model="gpt-4o-mini")
|
| 19 |
parser = StrOutputParser()
|
| 20 |
chain = prompt_template | model | parser
|
| 21 |
|
|
|
|
| 27 |
fn=generate_response,
|
| 28 |
inputs="text",
|
| 29 |
outputs="text",
|
| 30 |
+
title="憤怒鳥之逆襲",
|
| 31 |
+
description="哈哈笑死"
|
| 32 |
|
| 33 |
)
|
| 34 |
|