Spaces:
Configuration error
Configuration error
""" | |
execute_command.py | |
------------------- | |
This script handles the execution of commands sent to HarmonyAI. | |
""" | |
import requests | |
def is_safe(command, script): | |
# Implement safety checks here | |
return True | |
def send_command_to_server(command, script): | |
response = requests.post("http://localhost:5000/execute", json={"command": command, "script": script}) | |
return response.json() | |
def execute_command(command, script): | |
if is_safe(command, script): | |
result = send_command_to_server(command, script) | |
print(result) | |
else: | |
print("Command is not safe to execute.") | |
# Example usage | |
command = "Go through my email, find the website I signed up for, and cancel my subscription." | |
script = """#!/bin/bash | |
# Script to search emails and cancel subscription | |
python search_emails.py --action cancel_subscription""" | |
execute_command(command, script) | |