Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -18,27 +18,13 @@ def generate_text(prompt):
|
|
18 |
)
|
19 |
return response.choices[0].text.strip()
|
20 |
|
21 |
-
# def placeholder_fn(input_text):
|
22 |
-
# pass
|
23 |
-
|
24 |
-
# password_box = gr.Textbox(label="Enter password", type="password")
|
25 |
-
|
26 |
-
# def check_password(password, prompt):
|
27 |
-
|
28 |
-
# password = gr.password("Enter password to continue")
|
29 |
-
if password != "patti-ai":
|
30 |
-
print("Incorrect password!")
|
31 |
-
return False
|
32 |
-
else:
|
33 |
-
fn = generate_text
|
34 |
-
return True
|
35 |
|
36 |
# Create Gradio interface
|
37 |
input_text = gr.Textbox(label="Enter prompt", type="text")
|
38 |
output_text = gr.Textbox(label="AI response", type="text")
|
39 |
demo = gr.Interface(
|
40 |
-
fn =
|
41 |
-
inputs=
|
42 |
outputs=output_text,
|
43 |
title="AI Chatbot for PlanetTogether Knowledge Base",
|
44 |
description="Ask a question about the PlanetTogether APS:",
|
@@ -46,20 +32,5 @@ demo = gr.Interface(
|
|
46 |
theme="default"
|
47 |
)
|
48 |
|
49 |
-
# Define password-protected Gradio interface
|
50 |
-
#def check_password(password):
|
51 |
-
# if password == "patti-ai":
|
52 |
-
# input_text.visible = True
|
53 |
-
# password_box.visible = False
|
54 |
-
# fn=generate_text
|
55 |
-
# return "Access granted"
|
56 |
-
# else:
|
57 |
-
# input_text.visible = False
|
58 |
-
# password_box.visible = True
|
59 |
-
# print "Access denied"
|
60 |
-
|
61 |
-
# Set function for Gradio interface
|
62 |
-
# demo.fn = check_password
|
63 |
-
|
64 |
# Launch demo
|
65 |
demo.launch()
|
|
|
18 |
)
|
19 |
return response.choices[0].text.strip()
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
# Create Gradio interface
|
23 |
input_text = gr.Textbox(label="Enter prompt", type="text")
|
24 |
output_text = gr.Textbox(label="AI response", type="text")
|
25 |
demo = gr.Interface(
|
26 |
+
fn = generate_text,
|
27 |
+
inputs=input_text,
|
28 |
outputs=output_text,
|
29 |
title="AI Chatbot for PlanetTogether Knowledge Base",
|
30 |
description="Ask a question about the PlanetTogether APS:",
|
|
|
32 |
theme="default"
|
33 |
)
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
# Launch demo
|
36 |
demo.launch()
|