Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,24 +19,21 @@ def generate_text(prompt):
|
|
| 19 |
return response.choices[0].text.strip()
|
| 20 |
|
| 21 |
# Define password-protected Gradio interface
|
| 22 |
-
|
| 23 |
-
|
| 24 |
# demo.interface.visible = True
|
| 25 |
# demo.password_box.visible = False
|
| 26 |
# else:
|
| 27 |
# demo.interface.visible = False
|
| 28 |
# demo.password_box.visible = True
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
print("Incorrect password!")
|
| 34 |
-
return False
|
| 35 |
-
return True
|
| 36 |
|
| 37 |
# Create Gradio interface
|
| 38 |
-
input_text = gr.Textbox(label="Enter prompt",
|
| 39 |
-
output_text = gr.Textbox(label="AI Response",
|
| 40 |
demo = gr.Interface(
|
| 41 |
fn=check_password,
|
| 42 |
inputs=input_text,
|
|
|
|
| 19 |
return response.choices[0].text.strip()
|
| 20 |
|
| 21 |
# Define password-protected Gradio interface
|
| 22 |
+
def check_password(password):
|
| 23 |
+
if password == "password":
|
| 24 |
# demo.interface.visible = True
|
| 25 |
# demo.password_box.visible = False
|
| 26 |
# else:
|
| 27 |
# demo.interface.visible = False
|
| 28 |
# demo.password_box.visible = True
|
| 29 |
+
return "Access granted"
|
| 30 |
+
else:
|
| 31 |
+
retunr "Access denied"
|
| 32 |
+
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
# Create Gradio interface
|
| 35 |
+
input_text = gr.Textbox(label="Enter prompt", type="password")
|
| 36 |
+
output_text = gr.Textbox(label="AI Response", type="text")
|
| 37 |
demo = gr.Interface(
|
| 38 |
fn=check_password,
|
| 39 |
inputs=input_text,
|