Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -17,6 +17,22 @@ def CustomChatGPT(category, user_input):
|
|
17 |
messages.append({"role": "assistant", "content": ChatGPT_reply})
|
18 |
return ChatGPT_reply
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
iface = gr.Interface(
|
21 |
fn=CustomChatGPT,
|
22 |
inputs=[gr.inputs.Dropdown(choices=['BioTrack', 'Regulations', 'Best Practices', 'General Question'], label='Category'), gr.inputs.Textbox(lines=1, placeholder='Type here...', label='Your Question')],
|
@@ -29,10 +45,10 @@ iface = gr.Interface(
|
|
29 |
["Best Practices", "What are the benefits of offering delivery service for my dispensary?"],
|
30 |
["General Question", "What are the key trends in the cannabis industry?"]
|
31 |
],
|
32 |
-
|
33 |
-
theme=gr.themes.Monochrome()
|
34 |
-
|
35 |
)
|
36 |
|
37 |
-
|
|
|
|
|
38 |
|
|
|
17 |
messages.append({"role": "assistant", "content": ChatGPT_reply})
|
18 |
return ChatGPT_reply
|
19 |
|
20 |
+
# Define the authentication function
|
21 |
+
def check_auth(username, password):
|
22 |
+
valid_credentials = [
|
23 |
+
("user1", "password1"),
|
24 |
+
("user2", "password2"),
|
25 |
+
("user3", "password3"),
|
26 |
+
("user4", "password4"),
|
27 |
+
("user5", "password5")
|
28 |
+
]
|
29 |
+
|
30 |
+
for valid_username, valid_password in valid_credentials:
|
31 |
+
if username == valid_username and password == valid_password:
|
32 |
+
return True
|
33 |
+
|
34 |
+
return False
|
35 |
+
|
36 |
iface = gr.Interface(
|
37 |
fn=CustomChatGPT,
|
38 |
inputs=[gr.inputs.Dropdown(choices=['BioTrack', 'Regulations', 'Best Practices', 'General Question'], label='Category'), gr.inputs.Textbox(lines=1, placeholder='Type here...', label='Your Question')],
|
|
|
45 |
["Best Practices", "What are the benefits of offering delivery service for my dispensary?"],
|
46 |
["General Question", "What are the key trends in the cannabis industry?"]
|
47 |
],
|
48 |
+
theme=gr.themes.Base()
|
|
|
|
|
49 |
)
|
50 |
|
51 |
+
# Launch the interface with authentication
|
52 |
+
iface.launch(auth=check_auth)
|
53 |
+
|
54 |
|