Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- app.py +20 -0
- requirements.txt +1 -0
app.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
# Function to generate Fibonacci sequence
|
| 4 |
+
def generate_fibonacci(n):
|
| 5 |
+
fib = [0, 1]
|
| 6 |
+
while len(fib) < n:
|
| 7 |
+
fib.append(fib[-1] + fib[-2])
|
| 8 |
+
return fib[:n]
|
| 9 |
+
|
| 10 |
+
# Gradio interface
|
| 11 |
+
iface = gr.Interface(
|
| 12 |
+
fn=generate_fibonacci,
|
| 13 |
+
inputs=gr.Number(label="Enter number of terms (N)", precision=0),
|
| 14 |
+
outputs=gr.Text(label="Fibonacci Sequence"),
|
| 15 |
+
title="Fibonacci Sequence Generator",
|
| 16 |
+
description="Enter a number to generate the first N terms of the Fibonacci sequence."
|
| 17 |
+
)
|
| 18 |
+
|
| 19 |
+
# Launch the app
|
| 20 |
+
iface.launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
gradio
|