Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,7 +18,6 @@ with gr.Blocks() as demo:
|
|
| 18 |
with gr.Row(visible = True) as apicheck:
|
| 19 |
with gr.Column(scale = 6):
|
| 20 |
apikey = gr.Textbox(label='Paste here your OpenAI - API key', info='No API key is stored and only you will see it.', lines = 1)
|
| 21 |
-
openai.api_key = apikey.value
|
| 22 |
with gr.Column(scale = 1):
|
| 23 |
useapi = gr.Button("Use this API key")
|
| 24 |
with gr.Row(visible = False) as fullblock:
|
|
@@ -111,6 +110,7 @@ with gr.Blocks() as demo:
|
|
| 111 |
|
| 112 |
def checkapiinput(apikey):
|
| 113 |
if apikey != "" and apikey is not None and len(apikey) >=25 and len(apikey) <= 130:
|
|
|
|
| 114 |
return gr.update(visible=True), gr.update(visible=False), gr.update(visible=True), gr.update(visible=True)
|
| 115 |
else:
|
| 116 |
return gr.update(visible=False), gr.update(visible=True), gr.update(value="", placeholder="Use a valid API key"), gr.update(visible=False)
|
|
|
|
| 18 |
with gr.Row(visible = True) as apicheck:
|
| 19 |
with gr.Column(scale = 6):
|
| 20 |
apikey = gr.Textbox(label='Paste here your OpenAI - API key', info='No API key is stored and only you will see it.', lines = 1)
|
|
|
|
| 21 |
with gr.Column(scale = 1):
|
| 22 |
useapi = gr.Button("Use this API key")
|
| 23 |
with gr.Row(visible = False) as fullblock:
|
|
|
|
| 110 |
|
| 111 |
def checkapiinput(apikey):
|
| 112 |
if apikey != "" and apikey is not None and len(apikey) >=25 and len(apikey) <= 130:
|
| 113 |
+
openai.api_key = apikey.value
|
| 114 |
return gr.update(visible=True), gr.update(visible=False), gr.update(visible=True), gr.update(visible=True)
|
| 115 |
else:
|
| 116 |
return gr.update(visible=False), gr.update(visible=True), gr.update(value="", placeholder="Use a valid API key"), gr.update(visible=False)
|