Team Ai
Apppublic

dnnsdunca/Codex_Prime

sourceHugging Faceapache-2.0updated 2y agoView on Hugging Face
0likes
generate.py40 linesDownload Raw Back to src
1from agent import CodingAgent2from utils import load_config3 4def main():5    config = load_config('configs/model_config.yaml')6    agent = CodingAgent("./final_model")7 8    while True:9        print("\nChoose an action:")10        print("1. Generate code")11        print("2. Answer coding question")12        print("3. Explain code")13        print("4. Suggest improvements")14        print("5. Exit")15 16        choice = input("Enter your choice (1-5): ")17 18        if choice == '1':19            prompt = input("Enter a prompt for code generation: ")20            code = agent.generate_code(prompt)21            print("\nGenerated Code:\n", code)22        elif choice == '2':23            question = input("Enter your coding question: ")24            answer = agent.answer_coding_question(question)25            print("\nAnswer:\n", answer)26        elif choice == '3':27            code = input("Enter the code to explain: ")28            explanation = agent.explain_code(code)29            print("\nExplanation:\n", explanation)30        elif choice == '4':31            code = input("Enter the code for improvement suggestions: ")32            suggestions = agent.suggest_improvements(code)33            print("\nSuggestions:\n", suggestions)34        elif choice == '5':35            break36        else:37            print("Invalid choice. Please try again.")38 39if __name__ == "__main__":40    main()