Spaces:
Sleeping
Sleeping
Commit
·
c5d2cfb
1
Parent(s):
55ede6b
Synced repo using 'sync_with_huggingface' Github Action
Browse files
app.py
CHANGED
|
@@ -30,7 +30,8 @@ def openai_create(prompt):
|
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
-
def chatgpt_clone(input, history):
|
|
|
|
| 34 |
history = history or []
|
| 35 |
s = list(sum(history, ()))
|
| 36 |
s.append(input)
|
|
@@ -50,6 +51,13 @@ with block:
|
|
| 50 |
message = gr.Textbox(placeholder=prompt)
|
| 51 |
state = gr.State()
|
| 52 |
submit = gr.Button("SEND")
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
block.launch(debug = True)
|
|
|
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
+
def chatgpt_clone(key, input, history):
|
| 34 |
+
openai.api_key = key
|
| 35 |
history = history or []
|
| 36 |
s = list(sum(history, ()))
|
| 37 |
s.append(input)
|
|
|
|
| 51 |
message = gr.Textbox(placeholder=prompt)
|
| 52 |
state = gr.State()
|
| 53 |
submit = gr.Button("SEND")
|
| 54 |
+
keyTxt = gr.Textbox(
|
| 55 |
+
show_label=True,
|
| 56 |
+
placeholder=f"Your API-key...",
|
| 57 |
+
type="password",
|
| 58 |
+
visible=True,
|
| 59 |
+
label="API-Key",
|
| 60 |
+
)
|
| 61 |
+
submit.click(chatgpt_clone, inputs=[keyTxt, message, state], outputs=[chatbot, state])
|
| 62 |
|
| 63 |
block.launch(debug = True)
|