Commit
·
879be0f
1
Parent(s):
826dd93
Update app.py
Browse files
app.py
CHANGED
|
@@ -20,6 +20,7 @@ msg_panel = chat_interface.send(
|
|
| 20 |
user="assistant",
|
| 21 |
respond=False,
|
| 22 |
)
|
|
|
|
| 23 |
website_url_input = pn.widgets.TextInput(name='Website URL', placeholder="https://www.google.com/")
|
| 24 |
submit = pn.widgets.Button(name='Submit', button_type='primary')
|
| 25 |
|
|
@@ -30,7 +31,7 @@ def on_submit(event, contents, ):
|
|
| 30 |
SimpleWebPageReader = download_loader("SimpleWebPageReader")
|
| 31 |
|
| 32 |
# Set OpenAI API key
|
| 33 |
-
openai.api_key =
|
| 34 |
|
| 35 |
# Get the entered website URL
|
| 36 |
website_url = website_url_input.value
|
|
@@ -81,7 +82,7 @@ submit.on_click(on_submit)
|
|
| 81 |
# Instantiate the template with widgets displayed in the sidebar
|
| 82 |
template = pn.template.FastListTemplate(
|
| 83 |
title='Chat with Web',
|
| 84 |
-
sidebar=[website_url_input, submit,
|
| 85 |
msg_panel],
|
| 86 |
header=[],
|
| 87 |
|
|
|
|
| 20 |
user="assistant",
|
| 21 |
respond=False,
|
| 22 |
)
|
| 23 |
+
apikey = pn.widgets.TextInput(name='OPENAI API KEY', placeholder="sk-********")
|
| 24 |
website_url_input = pn.widgets.TextInput(name='Website URL', placeholder="https://www.google.com/")
|
| 25 |
submit = pn.widgets.Button(name='Submit', button_type='primary')
|
| 26 |
|
|
|
|
| 31 |
SimpleWebPageReader = download_loader("SimpleWebPageReader")
|
| 32 |
|
| 33 |
# Set OpenAI API key
|
| 34 |
+
openai.api_key = apikey.value # Replace with your actual API key
|
| 35 |
|
| 36 |
# Get the entered website URL
|
| 37 |
website_url = website_url_input.value
|
|
|
|
| 82 |
# Instantiate the template with widgets displayed in the sidebar
|
| 83 |
template = pn.template.FastListTemplate(
|
| 84 |
title='Chat with Web',
|
| 85 |
+
sidebar=[apikey,website_url_input, submit,
|
| 86 |
msg_panel],
|
| 87 |
header=[],
|
| 88 |
|