-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.py
33 lines (25 loc) · 880 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from cactus.agent import Cactus
import subprocess
def main():
# Initialize the Cactus API model
api_model = Cactus(model_name="gpt-3.5-turbo", model_type="api")
# Example command to execute on Windows
command = "reinvent -l sampling.log sampling.toml"
# Run the command
result = subprocess.run(command, shell=True, capture_output=True, text=True)
# Check the result
if result.returncode == 0:
print("Command executed successfully.")
print("Output:")
print(result.stdout)
else:
print("Command failed. Error output:")
print(result.stderr)
# Take user input for the query
user_query = input("How can I help you? ")
# Run the model with the user query
response = api_model.run(user_query)
# Print the response
print(response)
if __name__ == "__main__":
main()