Spaces:
Runtime error
Runtime error
Tidied up some comments
Browse files- pages/030_Test_Runner.py +14 -1
pages/030_Test_Runner.py
CHANGED
|
@@ -10,8 +10,10 @@ from src.testing import TestGenerator, batch_test
|
|
| 10 |
from src.st_helpers import st_setup
|
| 11 |
|
| 12 |
|
| 13 |
-
# Componentise different test options
|
| 14 |
def display_custom_test():
|
|
|
|
|
|
|
|
|
|
| 15 |
st.write("## Run a new custom test")
|
| 16 |
st.write("### Comment:")
|
| 17 |
comment = st.text_input("Optional comment for the test", key="custom_test_comment")
|
|
@@ -41,7 +43,14 @@ def display_custom_test():
|
|
| 41 |
|
| 42 |
|
| 43 |
def display_pricing_fact_test():
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
def get_question_price_pairs():
|
|
|
|
|
|
|
|
|
|
| 45 |
DataLoader.load_data()
|
| 46 |
pairs = []
|
| 47 |
for p in Product.all.values():
|
|
@@ -55,6 +64,10 @@ def display_pricing_fact_test():
|
|
| 55 |
return pairs
|
| 56 |
|
| 57 |
def get_price_from_response(response: str) -> float:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
prices = re.findall('\$[,\d]+\.\d\d', response)
|
| 59 |
if len(prices) == 0:
|
| 60 |
return -0.1
|
|
|
|
| 10 |
from src.st_helpers import st_setup
|
| 11 |
|
| 12 |
|
|
|
|
| 13 |
def display_custom_test():
|
| 14 |
+
"""
|
| 15 |
+
Write to the UI the ability to run some customised tests
|
| 16 |
+
"""
|
| 17 |
st.write("## Run a new custom test")
|
| 18 |
st.write("### Comment:")
|
| 19 |
comment = st.text_input("Optional comment for the test", key="custom_test_comment")
|
|
|
|
| 43 |
|
| 44 |
|
| 45 |
def display_pricing_fact_test():
|
| 46 |
+
"""
|
| 47 |
+
Write to the UI the ability to run some of the pricing fact test - asking the
|
| 48 |
+
architectures to state the prices for given products and calculating the resuting accuracy
|
| 49 |
+
"""
|
| 50 |
def get_question_price_pairs():
|
| 51 |
+
"""
|
| 52 |
+
Returns the complete list of pricing questions along with the correct prices
|
| 53 |
+
"""
|
| 54 |
DataLoader.load_data()
|
| 55 |
pairs = []
|
| 56 |
for p in Product.all.values():
|
|
|
|
| 64 |
return pairs
|
| 65 |
|
| 66 |
def get_price_from_response(response: str) -> float:
|
| 67 |
+
"""
|
| 68 |
+
Parses a string with regex to get a float value for comparison to what the
|
| 69 |
+
architecture said the price was
|
| 70 |
+
"""
|
| 71 |
prices = re.findall('\$[,\d]+\.\d\d', response)
|
| 72 |
if len(prices) == 0:
|
| 73 |
return -0.1
|