Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ import requests
|
|
5 |
import json
|
6 |
|
7 |
openai.api_key = os.environ.get("OPENAI_API_KEY")
|
8 |
-
openai.
|
9 |
# OPENAI_API_BASE="https://api.chatanywhere.tech/v1"
|
10 |
prompt_templates = {"Default ChatGPT": ""}
|
11 |
|
@@ -85,13 +85,14 @@ with gr.Blocks(css=css) as demo:
|
|
85 |
|
86 |
|
87 |
with gr.Column(elem_id="col-container"):
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
gr.Markdown("""
|
89 |
-
# Sydney-AI <b>
|
90 |
-
<p align="left"> This app is an intelligent online chat app developed based on the newly released OpenAI API "gpt-3.5-turbo". The app's operating costs are sponsored by "45度科研人". Currently, the tokens is limited to 3000. If you want to remove this restriction, you can input your own OpenAI API key.<p>
|
91 |
-
<p align="left"> The default model role of the app is the original assistant of ChatGPT, but you can also choose from the provided roles. <p>
|
92 |
-
<p align="left"> Two adjustable parameters are provided to optimize the model: temperature, where a larger value leads to more creative replies, and max tokens, where a larger value allows the model to reply with more content. <p>
|
93 |
-
""")
|
94 |
-
|
95 |
with gr.Row():
|
96 |
with gr.Column():
|
97 |
chatbot = gr.Chatbot(elem_id="chatbox").style(color_map=("blue", "green"))
|
@@ -100,7 +101,7 @@ with gr.Blocks(css=css) as demo:
|
|
100 |
total_tokens_str = gr.Markdown(elem_id="total_tokens_str")
|
101 |
btn_clear_conversation = gr.Button("Restart Conversation")
|
102 |
with gr.Column():
|
103 |
-
gr.Markdown("Enter your own OpenAI API Key to remove the 3000 token limit. You can get it follow this instruction [here](https://blog.pangao.vip/%E8%B6%85%E8%AF%A6%E7%BB%86%E6%B3%A8%E5%86%8COpenAI%E6%8E%A5%E5%8F%A3%E8%B4%A6%E5%8F%B7%E7%9A%84%E6%95%99%E7%A8%8B/).", elem_id="label")
|
104 |
user_token = gr.Textbox(placeholder="OpenAI API Key", type="password", show_label=False)
|
105 |
prompt_template = gr.Dropdown(label="Set a custom insruction for the chatbot:", choices=list(prompt_templates.keys()))
|
106 |
prompt_template_preview = gr.Markdown(elem_id="prompt_template_preview")
|
|
|
5 |
import json
|
6 |
|
7 |
openai.api_key = os.environ.get("OPENAI_API_KEY")
|
8 |
+
openai.api_base="https://api.chatanywhere.tech/v1"
|
9 |
# OPENAI_API_BASE="https://api.chatanywhere.tech/v1"
|
10 |
prompt_templates = {"Default ChatGPT": ""}
|
11 |
|
|
|
85 |
|
86 |
|
87 |
with gr.Column(elem_id="col-container"):
|
88 |
+
# gr.Markdown("""
|
89 |
+
# # Sydney-AI <b>
|
90 |
+
# <p align="left"> This app is an intelligent online chat app developed based on the newly released OpenAI API "gpt-3.5-turbo". The app's operating costs are sponsored by "45度科研人". Currently, the tokens is limited to 3000. If you want to remove this restriction, you can input your own OpenAI API key.<p>
|
91 |
+
# <p align="left"> The default model role of the app is the original assistant of ChatGPT, but you can also choose from the provided roles. <p>
|
92 |
+
# <p align="left"> Two adjustable parameters are provided to optimize the model: temperature, where a larger value leads to more creative replies, and max tokens, where a larger value allows the model to reply with more content. <p>
|
93 |
+
# """)
|
94 |
gr.Markdown("""
|
95 |
+
# Sydney-AI <b>""")
|
|
|
|
|
|
|
|
|
|
|
96 |
with gr.Row():
|
97 |
with gr.Column():
|
98 |
chatbot = gr.Chatbot(elem_id="chatbox").style(color_map=("blue", "green"))
|
|
|
101 |
total_tokens_str = gr.Markdown(elem_id="total_tokens_str")
|
102 |
btn_clear_conversation = gr.Button("Restart Conversation")
|
103 |
with gr.Column():
|
104 |
+
# gr.Markdown("Enter your own OpenAI API Key to remove the 3000 token limit. You can get it follow this instruction [here](https://blog.pangao.vip/%E8%B6%85%E8%AF%A6%E7%BB%86%E6%B3%A8%E5%86%8COpenAI%E6%8E%A5%E5%8F%A3%E8%B4%A6%E5%8F%B7%E7%9A%84%E6%95%99%E7%A8%8B/).", elem_id="label")
|
105 |
user_token = gr.Textbox(placeholder="OpenAI API Key", type="password", show_label=False)
|
106 |
prompt_template = gr.Dropdown(label="Set a custom insruction for the chatbot:", choices=list(prompt_templates.keys()))
|
107 |
prompt_template_preview = gr.Markdown(elem_id="prompt_template_preview")
|