Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -30,5 +30,6 @@ if st.button('GENERATE RESPONSE'):
|
|
30 |
# dialog = [f'{{init description: [“{text_init}“],\n deploy description: [“{text_deploy}“],\n invariant description: [“{text_invariant}“],\n}}']
|
31 |
# response = generate(instruction, knowledge, dialog)
|
32 |
PROMPT_TEXT = f'Using the EXAMPLE1 below, write the init(), deploy() and invariant() code for the EXAMPLE2:\nEXAMPLE1:\n[\n{{\n init description: [“Create a new address called “user”. Give the “user” “AMOUNT” of LP tokens. Using the “user” as the sender approve the “StaxLPStaking” contract to use his LP tokens and stake all the LP tokens into the “StaxLPStaking” contract.“],\n deploy description: [“Create a new address called “owner”. Using the “owner” as the sender deploy the “StaxLP” contract and the “StaxLPStaking” contract.“],\n invariant description: [“Using the “user” address as sender withdraw all the LP tokens from the “StaxLPStaking” contract and check the balance of the LP tokens of the “user” is not less than “AMOUNT”.“],\n init code: [{{\naddress public user;\nuint256 public constant AMOUNT = 10e18;\nfunction init() public {{\n user = makeAddr(“USER”);\n deal(address(lp), user, AMOUNT);\n vm.startPrank(user);\n lp.approve(address(lpStaking), lp.balanceOf(user));\n lpStaking.stakeAll();\n vm.stopPrank();\n}}\n }}],\n deploy code: [{{\nStaxLP public lp;\nStaxLPStaking public lpStaking;\naddress public owner;\nfunction deploy() public {{\n owner = makeAddr(“OWNER”);\n vm.startPrank(owner);\n lp = new StaxLP(“Stax Frax/Temple LP Token”, “xFraxTempleLP”);\n lpStaking = new StaxLPStaking(address(lp), owner);\n vm.stopPrank();\n}}\n }}],\n invariant code: [{{\nfunction invariant() public {{\n vm.prank(user);\n lpStaking.withdrawAll(false);\n assert(lp.balanceOf(user) >= AMOUNT);\n}}\n }}],\n}}\n]\nEXAMPLE2:\n{{\n init description: [“{text_init}“],\n deploy description: [“{text_deploy}“],\n invariant description: [“{text_invariant}“],\n}}'
|
33 |
-
|
34 |
-
|
|
|
|
30 |
# dialog = [f'{{init description: [“{text_init}“],\n deploy description: [“{text_deploy}“],\n invariant description: [“{text_invariant}“],\n}}']
|
31 |
# response = generate(instruction, knowledge, dialog)
|
32 |
PROMPT_TEXT = f'Using the EXAMPLE1 below, write the init(), deploy() and invariant() code for the EXAMPLE2:\nEXAMPLE1:\n[\n{{\n init description: [“Create a new address called “user”. Give the “user” “AMOUNT” of LP tokens. Using the “user” as the sender approve the “StaxLPStaking” contract to use his LP tokens and stake all the LP tokens into the “StaxLPStaking” contract.“],\n deploy description: [“Create a new address called “owner”. Using the “owner” as the sender deploy the “StaxLP” contract and the “StaxLPStaking” contract.“],\n invariant description: [“Using the “user” address as sender withdraw all the LP tokens from the “StaxLPStaking” contract and check the balance of the LP tokens of the “user” is not less than “AMOUNT”.“],\n init code: [{{\naddress public user;\nuint256 public constant AMOUNT = 10e18;\nfunction init() public {{\n user = makeAddr(“USER”);\n deal(address(lp), user, AMOUNT);\n vm.startPrank(user);\n lp.approve(address(lpStaking), lp.balanceOf(user));\n lpStaking.stakeAll();\n vm.stopPrank();\n}}\n }}],\n deploy code: [{{\nStaxLP public lp;\nStaxLPStaking public lpStaking;\naddress public owner;\nfunction deploy() public {{\n owner = makeAddr(“OWNER”);\n vm.startPrank(owner);\n lp = new StaxLP(“Stax Frax/Temple LP Token”, “xFraxTempleLP”);\n lpStaking = new StaxLPStaking(address(lp), owner);\n vm.stopPrank();\n}}\n }}],\n invariant code: [{{\nfunction invariant() public {{\n vm.prank(user);\n lpStaking.withdrawAll(false);\n assert(lp.balanceOf(user) >= AMOUNT);\n}}\n }}],\n}}\n]\nEXAMPLE2:\n{{\n init description: [“{text_init}“],\n deploy description: [“{text_deploy}“],\n invariant description: [“{text_invariant}“],\n}}'
|
33 |
+
responses = generator(PROMPT_TEXT, max_length=300, num_return_sequences=5)
|
34 |
+
for response in responses:
|
35 |
+
st.write(response)
|