Usage

Quick Start

  1. Import the necessary libraries:

    Import the essential libraries for quantum computing and set your OpenAI API key.

    
    import cirq
    import qiskit
    import pennylane as qml
    from pyquil import Program
    
    # Set your OpenAI API key
    openai.api_key = "<YOUR_OPENAI_API_KEY>"
  2. Translate Myanmar Instruction to Quantum Code:

    The following function translates a given quantum instruction in Myanmar language to its equivalent quantum computing code using frameworks like Cirq, Qiskit, etc.

    
        response = openai.Completion.create(
            engine="text-davinci-003",
            prompt=f"Translate the following instruction in Myanmar language to a Quantum Computing code snippet (Cirq, Qiskit, etc.): {myanmar_instruction}",
            max_tokens=300,
            temperature=0.5,
            n=1,
            stop=None,
        )
        code = response.choices[0].text.strip()
        return code
  3. Execute Quantum Code:

    This function allows users to execute the translated quantum code in Python without displaying the code execution details.

    
        try:
            exec_globals = {}
            exec_locals = {}
            exec(code, exec_globals, exec_locals)
            
            result = exec_locals.get('result', 'Output not available')
            return str(result)
        except Exception as e:
            return f"Error in execution: {str(e)}"

Sample Workflow

  1. Translate and Execute a CNOT Gate Instruction:

  2. Translate and Execute a Hadamard Gate Instruction:

Last updated