Upload app.py
Browse files
app.py
CHANGED
@@ -9,6 +9,8 @@ API_URL = "https://ai.fakeopen.com/v1/chat/completions" # 用户需要提供自
|
|
9 |
# 推断函数
|
10 |
def predict(openai_gpt4_key, system_msg, inputs, top_p, temperature, chat_counter, chatbot=[], history=[]):
|
11 |
|
|
|
|
|
12 |
headers = {
|
13 |
"Content-Type": "application/json",
|
14 |
"Authorization": f"Bearer {openai_gpt4_key}" # 用户将提供自己的 OPENAI_API_KEY
|
@@ -110,7 +112,7 @@ def set_visible_true():
|
|
110 |
|
111 |
title = """<h1 align="center">🔥 使用 Chat-Completions API 和 🚀 Gradio-Streaming 的 GPT4</h1>"""
|
112 |
# 主题功能的显示消息
|
113 |
-
theme_addon_msg = """<center>🌟 这个演示还向你介绍了 Gradio 主题。在 Gradio
|
114 |
"""
|
115 |
|
116 |
# 使用信息添加有关 GPT4 系统消息的其他信息
|
@@ -173,12 +175,12 @@ with gr.Blocks(css = """#col_container { margin-left: auto; margin-right: auto;}
|
|
173 |
with gr.Accordion(label="系统消息示例:", open=False):
|
174 |
gr.Examples(
|
175 |
examples = [
|
176 |
-
["""你是一个 AI
|
177 |
|
178 |
- 仔细并准确地遵循用户的要求。
|
179 |
-
-
|
180 |
- 然后将代码以单个代码块的形式输出。
|
181 |
-
-
|
182 |
["你是一位幽默的助手,名叫 ComedianGPT。你的回答都带有笑话和机智的回复。"],
|
183 |
["你是 ChefGPT,一位乐于助人的助手,用烹饪专业知识和一点点幽默来回答问题。"],
|
184 |
["你是 FitnessGuruGPT,一位健身专家,以轻松的方式分享锻炼技巧和动力。"],
|
|
|
9 |
# 推断函数
|
10 |
def predict(openai_gpt4_key, system_msg, inputs, top_p, temperature, chat_counter, chatbot=[], history=[]):
|
11 |
|
12 |
+
print(f"————————————————————")
|
13 |
+
|
14 |
headers = {
|
15 |
"Content-Type": "application/json",
|
16 |
"Authorization": f"Bearer {openai_gpt4_key}" # 用户将提供自己的 OPENAI_API_KEY
|
|
|
112 |
|
113 |
title = """<h1 align="center">🔥 使用 Chat-Completions API 和 🚀 Gradio-Streaming 的 GPT4</h1>"""
|
114 |
# 主题功能的显示消息
|
115 |
+
theme_addon_msg = """<center>🌟 这个演示还向你介绍了 Gradio 主题。在 Gradio 网站上查看我们的 <a href="https://gradio.app/theming-guide/" target="_blank">主题指南🎨</a>来了解更多吧!你可以从头开始开发,用 <code>theme.push_to_hub()</code> 修改现有的 Gradio 主题,并简单地上传到 huggingface-hub 来与社区分享你的主题。</center>
|
116 |
"""
|
117 |
|
118 |
# 使用信息添加有关 GPT4 系统消息的其他信息
|
|
|
175 |
with gr.Accordion(label="系统消息示例:", open=False):
|
176 |
gr.Examples(
|
177 |
examples = [
|
178 |
+
["""你是一个 AI 助手。
|
179 |
|
180 |
- 仔细并准确地遵循用户的要求。
|
181 |
+
- 先逐步思考 - 详细描述你在伪代码中要构建的计划。
|
182 |
- 然后将代码以单个代码块的形式输出。
|
183 |
+
- 尽少说无聊的闲话。"""],
|
184 |
["你是一位幽默的助手,名叫 ComedianGPT。你的回答都带有笑话和机智的回复。"],
|
185 |
["你是 ChefGPT,一位乐于助人的助手,用烹饪专业知识和一点点幽默来回答问题。"],
|
186 |
["你是 FitnessGuruGPT,一位健身专家,以轻松的方式分享锻炼技巧和动力。"],
|