Spaces:
Paused
Paused
Add prompts from fka/awesome-chatgpt-prompts
Browse files- app.py +7 -1
- requirements.txt +2 -1
app.py
CHANGED
|
@@ -6,6 +6,8 @@ import json
|
|
| 6 |
import time
|
| 7 |
import os
|
| 8 |
|
|
|
|
|
|
|
| 9 |
openai.api_key = os.getenv('API_KEY')
|
| 10 |
openai.request_times = 0
|
| 11 |
|
|
@@ -148,6 +150,10 @@ with gr.Blocks() as demo:
|
|
| 148 |
f"You are a helpful assistant. Today is {datetime.date.today()}.",
|
| 149 |
]
|
| 150 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
gr.Markdown(
|
| 152 |
"""
|
| 153 |
朋友你好,
|
|
@@ -180,7 +186,7 @@ with gr.Blocks() as demo:
|
|
| 180 |
button_clr = gr.Button("Clear")
|
| 181 |
|
| 182 |
downloadfile = gr.File(None, interactive=False, show_label=False, visible=False)
|
| 183 |
-
gr.Examples(examples=examples_bhv, inputs=bhv, label="Examples for setting behavior")
|
| 184 |
gr.Examples(examples=examples_txt, inputs=txt, label="Examples for asking question")
|
| 185 |
txt.submit(predict, [txt, state, behavior], [txt, state, chatbot])
|
| 186 |
button_gen.click(fn=predict, inputs=[txt, state, behavior], outputs=[txt, state, chatbot, downloadfile])
|
|
|
|
| 6 |
import time
|
| 7 |
import os
|
| 8 |
|
| 9 |
+
from datasets import load_dataset
|
| 10 |
+
|
| 11 |
openai.api_key = os.getenv('API_KEY')
|
| 12 |
openai.request_times = 0
|
| 13 |
|
|
|
|
| 150 |
f"You are a helpful assistant. Today is {datetime.date.today()}.",
|
| 151 |
]
|
| 152 |
|
| 153 |
+
prompt_dataset = load_dataset("fka/awesome-chatgpt-prompts")
|
| 154 |
+
examples_bhv = prompt_dataset['train'].to_dict()['prompt']
|
| 155 |
+
|
| 156 |
+
|
| 157 |
gr.Markdown(
|
| 158 |
"""
|
| 159 |
朋友你好,
|
|
|
|
| 186 |
button_clr = gr.Button("Clear")
|
| 187 |
|
| 188 |
downloadfile = gr.File(None, interactive=False, show_label=False, visible=False)
|
| 189 |
+
gr.Examples(examples=examples_bhv, inputs=bhv, label="Examples for setting behavior", examples_per_page=10)
|
| 190 |
gr.Examples(examples=examples_txt, inputs=txt, label="Examples for asking question")
|
| 191 |
txt.submit(predict, [txt, state, behavior], [txt, state, chatbot])
|
| 192 |
button_gen.click(fn=predict, inputs=[txt, state, behavior], outputs=[txt, state, chatbot, downloadfile])
|
requirements.txt
CHANGED
|
@@ -1,2 +1,3 @@
|
|
| 1 |
openai==0.27.0
|
| 2 |
-
tiktoken==0.3.0
|
|
|
|
|
|
| 1 |
openai==0.27.0
|
| 2 |
+
tiktoken==0.3.0
|
| 3 |
+
datasets
|