Upload 3 files
Browse files- Dockerfile +2 -2
- app.py +15 -12
- requirements.txt +1 -1
Dockerfile
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
-
FROM python:3.
|
| 2 |
WORKDIR /code
|
| 3 |
COPY ./requirements.txt /code/requirements.txt
|
| 4 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 5 |
COPY . .
|
| 6 |
-
CMD ["
|
|
|
|
| 1 |
+
FROM python:3.8
|
| 2 |
WORKDIR /code
|
| 3 |
COPY ./requirements.txt /code/requirements.txt
|
| 4 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 5 |
COPY . .
|
| 6 |
+
CMD ["panel", "serve", "/code/app.py", "--host", "nikhilj-Webpanel.hf.space", "--port", "7860"]
|
app.py
CHANGED
|
@@ -1,17 +1,20 @@
|
|
| 1 |
import panel as pn
|
| 2 |
|
| 3 |
-
# Create a list of numbers
|
| 4 |
numbers = [1, 2, 3, 4, 5]
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
pn.Text("Numbers"),
|
| 10 |
-
pn.Select(options=numbers, value=numbers[0]),
|
| 11 |
-
),
|
| 12 |
-
pn.Button("Add Number", click=lambda: numbers.append(numbers[-1] + 1)),
|
| 13 |
-
pn.Table(numbers),
|
| 14 |
-
)
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import panel as pn
|
| 2 |
|
|
|
|
| 3 |
numbers = [1, 2, 3, 4, 5]
|
| 4 |
|
| 5 |
+
def square_numbers():
|
| 6 |
+
squared = [num ** 2 for num in numbers]
|
| 7 |
+
return squared
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
+
pn.extension()
|
| 10 |
+
|
| 11 |
+
button = pn.widgets.Button(name='Square Numbers', button_type='primary')
|
| 12 |
+
output = pn.widgets.StaticText()
|
| 13 |
+
|
| 14 |
+
def button_click(event):
|
| 15 |
+
output.value = str(square_numbers())
|
| 16 |
+
|
| 17 |
+
button.on_click(button_click)
|
| 18 |
+
|
| 19 |
+
app = pn.Column(button, output)
|
| 20 |
+
app.servable()
|
requirements.txt
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
panel
|
|
|
|
| 1 |
+
panel==0.12.1
|