Update app.py
Browse files
app.py
CHANGED
@@ -18,9 +18,7 @@ examples = [#zero-shot
|
|
18 |
#few-shot-CoT
|
19 |
["Q: Roger has 5 tennis balls. He buys 2 more cans of tennis balls. Each can has 3 tennis balls. How many tennis balls does he have now?\nA: Roger started with 5 balls. 2 cans of 3 tennis balls each is 6 tennis balls. 5 + 6 = 11. The answer is 11.\nQ:A juggler can juggle 16 balls. Half of the balls are golf balls, and half of the golf balls are blue. How many blue golf balls are there?\nA:"],
|
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":
|
@@ -33,11 +31,10 @@ def calculator(num1, operation, num2):
|
|
33 |
return num1 / num2
|
34 |
|
35 |
def complete_with_gpt(text):
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
print("Error: API key is not valid")
|
41 |
return [interface(text) for interface in interfaces]
|
42 |
|
43 |
def set_example(example: list) -> dict:
|
|
|
18 |
#few-shot-CoT
|
19 |
["Q: Roger has 5 tennis balls. He buys 2 more cans of tennis balls. Each can has 3 tennis balls. How many tennis balls does he have now?\nA: Roger started with 5 balls. 2 cans of 3 tennis balls each is 6 tennis balls. 5 + 6 = 11. The answer is 11.\nQ:A juggler can juggle 16 balls. Half of the balls are golf balls, and half of the golf balls are blue. How many blue golf balls are there?\nA:"],
|
20 |
]
|
|
|
21 |
#examples from Figure 1 of the paper
|
|
|
22 |
|
23 |
def calculator(num1, operation, num2):
|
24 |
if operation == "add":
|
|
|
31 |
return num1 / num2
|
32 |
|
33 |
def complete_with_gpt(text):
|
34 |
+
try:
|
35 |
+
interfaces = [gr.Interface.load(name, api_key = "API_KEY2") for name in name_list]
|
36 |
+
except:
|
37 |
+
print("Error: API key is not valid")
|
|
|
38 |
return [interface(text) for interface in interfaces]
|
39 |
|
40 |
def set_example(example: list) -> dict:
|