Commit
·
251a318
1
Parent(s):
dd49910
Update playground.py
Browse files- tabs/playground.py +2 -20
tabs/playground.py
CHANGED
@@ -7,12 +7,6 @@ import os
|
|
7 |
import warnings
|
8 |
warnings.filterwarnings('ignore')
|
9 |
|
10 |
-
# if st.session_state.Cloud == 0:
|
11 |
-
# load_dotenv()
|
12 |
-
# os.getenv("OPENAI_API_KEY")
|
13 |
-
if 'OPENAI_API_KEY' in st.session_state:
|
14 |
-
openai.api_key = st.session_state['OPENAI_API_KEY'] # os.environ['OPENAI_API_KEY']
|
15 |
-
|
16 |
title = "Playground ChatGPT"
|
17 |
sidebar_name = "Playground"
|
18 |
|
@@ -21,7 +15,7 @@ def display_proba_next_token(prompt,temperature,max_token):
|
|
21 |
# Définir un ou plusieurs motifs d'arrêt
|
22 |
stop_sequences = [".","\n", "FIN", "Merci"] # Ajoutez d'autres motifs selon vos besoins
|
23 |
response = openai.Completion.create(
|
24 |
-
engine="davinci-003",
|
25 |
prompt=prompt,
|
26 |
max_tokens=max_token, # Limite à un seul token pour voir uniquement la probabilité du prochain
|
27 |
logprobs=5, # Obtenir les 5 tokens les plus probables
|
@@ -65,18 +59,7 @@ def run():
|
|
65 |
|
66 |
st.write("")
|
67 |
st.write("")
|
68 |
-
|
69 |
-
# st.image("https://dst-studio-template.s3.eu-west-3.amazonaws.com/1.gif")
|
70 |
-
# st.image("https://dst-studio-template.s3.eu-west-3.amazonaws.com/2.gif")
|
71 |
-
# st.image("https://dst-studio-template.s3.eu-west-3.amazonaws.com/3.gif")
|
72 |
-
# st.image("assets/tough-communication.gif",use_column_width=True)
|
73 |
-
|
74 |
-
|
75 |
-
# if st.session_state.Cloud == 0:
|
76 |
-
# st.image("assets/miss-honey-glasses-off.gif",use_column_width=True)
|
77 |
-
# else:
|
78 |
-
# st.image("https://media.tenor.com/pfOeAfytY98AAAAC/miss-honey-glasses-off.gif",use_column_width=True)
|
79 |
-
|
80 |
st.title(tr(title))
|
81 |
st.markdown('''
|
82 |
---
|
@@ -90,7 +73,6 @@ def run():
|
|
90 |
if 'OPENAI_API_KEY' in st.session_state:
|
91 |
try:
|
92 |
openai.api_key = st.session_state['OPENAI_API_KEY']
|
93 |
-
st.write(os.environ['OPENAI_API_KEY'])
|
94 |
col1, col2 = st.columns([3, 1])
|
95 |
with col2:
|
96 |
temperature = st.slider(
|
|
|
7 |
import warnings
|
8 |
warnings.filterwarnings('ignore')
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
title = "Playground ChatGPT"
|
11 |
sidebar_name = "Playground"
|
12 |
|
|
|
15 |
# Définir un ou plusieurs motifs d'arrêt
|
16 |
stop_sequences = [".","\n", "FIN", "Merci"] # Ajoutez d'autres motifs selon vos besoins
|
17 |
response = openai.Completion.create(
|
18 |
+
engine="text-davinci-003",
|
19 |
prompt=prompt,
|
20 |
max_tokens=max_token, # Limite à un seul token pour voir uniquement la probabilité du prochain
|
21 |
logprobs=5, # Obtenir les 5 tokens les plus probables
|
|
|
59 |
|
60 |
st.write("")
|
61 |
st.write("")
|
62 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
st.title(tr(title))
|
64 |
st.markdown('''
|
65 |
---
|
|
|
73 |
if 'OPENAI_API_KEY' in st.session_state:
|
74 |
try:
|
75 |
openai.api_key = st.session_state['OPENAI_API_KEY']
|
|
|
76 |
col1, col2 = st.columns([3, 1])
|
77 |
with col2:
|
78 |
temperature = st.slider(
|