Update app.py
Browse files
app.py
CHANGED
@@ -20,7 +20,8 @@ examples = [#zero-shot
|
|
20 |
]
|
21 |
|
22 |
#examples from Figure 1 of the paper
|
23 |
-
|
|
|
24 |
def calculator(num1, operation, num2):
|
25 |
if operation == "add":
|
26 |
return num1 + num2
|
@@ -32,7 +33,11 @@ def calculator(num1, operation, num2):
|
|
32 |
return num1 / num2
|
33 |
|
34 |
def complete_with_gpt(text):
|
35 |
-
|
|
|
|
|
|
|
|
|
36 |
return [interface(text) for interface in interfaces]
|
37 |
|
38 |
def set_example(example: list) -> dict:
|
@@ -77,7 +82,4 @@ with gr.Blocks() as demo:
|
|
77 |
"""
|
78 |
)
|
79 |
|
80 |
-
with gr.Row():
|
81 |
-
gr.Markdown("![visitor badge](https://visitor-badge.glitch.me/badge?page_id=gradio-blocks_zero-and-few-shot-reasoning)")
|
82 |
-
|
83 |
demo.launch(enable_queue=True, debug=True)
|
|
|
20 |
]
|
21 |
|
22 |
#examples from Figure 1 of the paper
|
23 |
+
secrets = [API_KEY, API_KEY2, API_KEY3, API_KEY4]
|
24 |
+
|
25 |
def calculator(num1, operation, num2):
|
26 |
if operation == "add":
|
27 |
return num1 + num2
|
|
|
33 |
return num1 / num2
|
34 |
|
35 |
def complete_with_gpt(text):
|
36 |
+
for secret in secrets:
|
37 |
+
try:
|
38 |
+
interfaces = [gr.Interface.load(name, api_key = "secret") for name in name_list]
|
39 |
+
except:
|
40 |
+
print("Error: API key is not valid")
|
41 |
return [interface(text) for interface in interfaces]
|
42 |
|
43 |
def set_example(example: list) -> dict:
|
|
|
82 |
"""
|
83 |
)
|
84 |
|
|
|
|
|
|
|
85 |
demo.launch(enable_queue=True, debug=True)
|