Spaces:
Sleeping
Sleeping
File size: 754 Bytes
db456d9 |
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 |
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()
|