import gradio as gr def fibonacci(n): """ Generate the Fibonacci sequence up to the nth term. Parameters: - n (int): The number of terms to generate in the Fibonacci sequence. Returns: - List[int]: A list containing the Fibonacci sequence. """ fib_sequence = [0, 1] while len(fib_sequence) < n: fib_sequence.append(fib_sequence[-1] + fib_sequence[-2]) return fib_sequence # Create a Gradio interface iface = gr.Interface( fn=fibonacci, inputs=gr.Number(), outputs=gr.Textbox(), live=True, theme="compact", title="Fibonacci Sequence Generator", description="Enter the number of terms to generate in the Fibonacci sequence:", ) # Launch the Gradio interface iface.launch()