Spaces:
Runtime error
Runtime error
Jin Ziqi
commited on
Commit
·
7965fa5
1
Parent(s):
ea1538a
update the interface
Browse files
app.py
CHANGED
|
@@ -22,15 +22,20 @@ openai.api_key = os.getenv("api_key")
|
|
| 22 |
|
| 23 |
def greet(question):
|
| 24 |
input = question + '\n\n' + "|step|subquestion|process|result|"
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
| 30 |
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
| 34 |
return "|step|subquestion|process|result|\n" + response
|
| 35 |
|
| 36 |
|
|
@@ -39,7 +44,11 @@ iface = gr.Interface(
|
|
| 39 |
inputs="text",
|
| 40 |
outputs="text",
|
| 41 |
title="Tab-CoT: Zero-Shot Tabular Chain-of-Thought",
|
| 42 |
-
examples=[
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
)
|
| 44 |
iface.launch()
|
| 45 |
|
|
|
|
| 22 |
|
| 23 |
def greet(question):
|
| 24 |
input = question + '\n\n' + "|step|subquestion|process|result|"
|
| 25 |
+
while True:
|
| 26 |
+
try:
|
| 27 |
+
response = openai.ChatCompletion.create(
|
| 28 |
+
model="gpt-3.5-turbo",
|
| 29 |
+
messages=[
|
| 30 |
+
{"role": "system", "content": "You are a helpful assistant that generate table to solve reasoning problem."},
|
| 31 |
+
{"role": "user", "content": input},
|
| 32 |
|
| 33 |
+
]
|
| 34 |
+
)
|
| 35 |
+
response = response["choices"][0]["message"]["content"]
|
| 36 |
+
except:
|
| 37 |
+
time.sleep(5)
|
| 38 |
+
continue
|
| 39 |
return "|step|subquestion|process|result|\n" + response
|
| 40 |
|
| 41 |
|
|
|
|
| 44 |
inputs="text",
|
| 45 |
outputs="text",
|
| 46 |
title="Tab-CoT: Zero-Shot Tabular Chain-of-Thought",
|
| 47 |
+
examples=[
|
| 48 |
+
["Tommy is fundraising for his charity by selling brownies for $3 a slice and cheesecakes for $4 a slice. If Tommy sells 43 brownies and 23 slices of cheesecake, how much money does Tommy raise?"],
|
| 49 |
+
["Judy teaches 5 dance classes, every day, on the weekdays and 8 classes on Saturday. If each class has 15 students and she charges $15.00 per student, how much money does she make in 1 week?"],
|
| 50 |
+
["According to its nutritional info, a bag of chips has 250 calories per serving. If a 300g bag has 5 servings, how many grams can you eat if your daily calorie target is 2000 and you have already consumed 1800 calories?"],
|
| 51 |
+
]
|
| 52 |
)
|
| 53 |
iface.launch()
|
| 54 |
|