Spaces:
Runtime error
Runtime error
error handling
Browse files
app.py
CHANGED
@@ -5,6 +5,10 @@ DEMO_SERVER = "4.208.9.167:80"
|
|
5 |
|
6 |
def run_query( prompt):
|
7 |
POLICY = "./cce_policy.txt"
|
|
|
|
|
|
|
|
|
8 |
try:
|
9 |
with SecureSession(f"http://{DEMO_SERVER}", POLICY) as secure_session:
|
10 |
res = secure_session.post(endpoint="/generate", json={"input_text": prompt})
|
|
|
5 |
|
6 |
def run_query( prompt):
|
7 |
POLICY = "./cce_policy.txt"
|
8 |
+
if prompt != True:
|
9 |
+
return("⛔ Error: invalid user input for query")
|
10 |
+
if prompt.len() == 0:
|
11 |
+
return("⛔ Error: please add your query for automated code completion")
|
12 |
try:
|
13 |
with SecureSession(f"http://{DEMO_SERVER}", POLICY) as secure_session:
|
14 |
res = secure_session.post(endpoint="/generate", json={"input_text": prompt})
|