Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -79,6 +79,19 @@ pwd_aoai_url = PasswordInput(
|
|
| 79 |
placeholder="Enter your Azure OpenAI Base Url here...",
|
| 80 |
sizing_mode="stretch_width",
|
| 81 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
openai_row = pn.Row(txt_model, pwd_openai_key, pwd_openai_url)
|
| 83 |
file_cfg = pn.widgets.FileInput(filename="OAI_CONFIG_LIST", sizing_mode="stretch_width")
|
| 84 |
template.main.append(
|
|
@@ -88,16 +101,7 @@ template.main.append(
|
|
| 88 |
[pn.pane.Markdown("### Yi Endpoint: "), YI_ENDPOINT]
|
| 89 |
)
|
| 90 |
)
|
| 91 |
-
|
| 92 |
-
# Add YI Mode Checkbox and Endpoint Input.
|
| 93 |
-
YI_MODE = pn.widgets.Checkbox(name='Local Y.I. Mode', value=True)
|
| 94 |
-
YI_ENDPOINT = pn.widgets.TextInput(name='Yi Endpoint', placeholder="Enter your YI endpoint here...")
|
| 95 |
|
| 96 |
-
def check_yi_mode(event):
|
| 97 |
-
# Make openai_row invisible when local YI Mode is enabled and vice versa.
|
| 98 |
-
openai_row.visible = not event.new
|
| 99 |
-
|
| 100 |
-
YI_MODE.param.watch(check_yi_mode, 'value')
|
| 101 |
|
| 102 |
def get_config(tmpfilename="OAI_CONFIG_LIST"):
|
| 103 |
os.makedirs(".chromadb", exist_ok=True)
|
|
|
|
| 79 |
placeholder="Enter your Azure OpenAI Base Url here...",
|
| 80 |
sizing_mode="stretch_width",
|
| 81 |
)
|
| 82 |
+
# Define YI Mode Checkbox and Endpoint Input.
|
| 83 |
+
YI_MODE = pn.widgets.Checkbox(name='Local Y.I. Mode', value=True)
|
| 84 |
+
YI_ENDPOINT = pn.widgets.TextInput(name='Yi Endpoint', placeholder="Enter your YI endpoint here...")
|
| 85 |
+
|
| 86 |
+
# Add an observer to watch changes in yi_mode value (True/False)
|
| 87 |
+
YI_MODE.param.watch(check_yi_mode, 'value')
|
| 88 |
+
|
| 89 |
+
def check_yi_mode(event):
|
| 90 |
+
# Make openai_row invisible when local YI Mode is enabled and vice versa.
|
| 91 |
+
openai_row.visible = not event.new
|
| 92 |
+
|
| 93 |
+
YI_MODE.param.watch(check_yi_mode, 'value')
|
| 94 |
+
|
| 95 |
openai_row = pn.Row(txt_model, pwd_openai_key, pwd_openai_url)
|
| 96 |
file_cfg = pn.widgets.FileInput(filename="OAI_CONFIG_LIST", sizing_mode="stretch_width")
|
| 97 |
template.main.append(
|
|
|
|
| 101 |
[pn.pane.Markdown("### Yi Endpoint: "), YI_ENDPOINT]
|
| 102 |
)
|
| 103 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
|
| 106 |
def get_config(tmpfilename="OAI_CONFIG_LIST"):
|
| 107 |
os.makedirs(".chromadb", exist_ok=True)
|