Spaces:
Runtime error
Runtime error
hello-check
Browse files- Code/app.py +5 -45
- Dockerfile +1 -1
- README.md +1 -0
- requirements.txt +0 -2
Code/app.py
CHANGED
|
@@ -1,47 +1,7 @@
|
|
| 1 |
-
|
| 2 |
-
import hvplot.pandas
|
| 3 |
|
| 4 |
-
|
| 5 |
-
from bokeh.sampledata.autompg import autompg_clean as df
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
# Define Panel widgets
|
| 11 |
-
cylinders = pn.widgets.IntSlider(name='Cylinders', start=4, end=8, step=2)
|
| 12 |
-
mfr = pn.widgets.ToggleGroup(
|
| 13 |
-
name='MFR',
|
| 14 |
-
options=['ford', 'chevrolet', 'honda', 'toyota', 'audi'],
|
| 15 |
-
value=['ford', 'chevrolet', 'honda', 'toyota', 'audi'],
|
| 16 |
-
button_type='success')
|
| 17 |
-
yaxis = pn.widgets.RadioButtonGroup(
|
| 18 |
-
name='Y axis',
|
| 19 |
-
options=['hp', 'weight'],
|
| 20 |
-
button_type='success'
|
| 21 |
-
)
|
| 22 |
-
|
| 23 |
-
# Combine pipeline and widgets
|
| 24 |
-
ipipeline = (
|
| 25 |
-
idf[
|
| 26 |
-
(idf.cyl == cylinders) &
|
| 27 |
-
(idf.mfr.isin(mfr))
|
| 28 |
-
]
|
| 29 |
-
.groupby(['origin', 'mpg'])[yaxis].mean()
|
| 30 |
-
.to_frame()
|
| 31 |
-
.reset_index()
|
| 32 |
-
.sort_values(by='mpg')
|
| 33 |
-
.reset_index(drop=True)
|
| 34 |
-
)
|
| 35 |
-
|
| 36 |
-
# Pipe to hvplot
|
| 37 |
-
ihvplot = ipipeline.hvplot(x='mpg', y=yaxis, by='origin', color=["#ff6f69", "#ffcc5c", "#88d8b0"], line_width=6, height=400)
|
| 38 |
-
|
| 39 |
-
# Layout using Template
|
| 40 |
-
template = pn.template.FastListTemplate(
|
| 41 |
-
title='Interactive DataFrame Dashboards with hvplot .interactive',
|
| 42 |
-
sidebar=[cylinders, 'Manufacturers', mfr, 'Y axis' , yaxis],
|
| 43 |
-
main=[ihvplot.panel()],
|
| 44 |
-
accent_base_color="#88d8b0",
|
| 45 |
-
header_background="#88d8b0",
|
| 46 |
-
)
|
| 47 |
-
template.servable()
|
|
|
|
| 1 |
+
from fastapi import FastAPI
|
|
|
|
| 2 |
|
| 3 |
+
app = FastAPI()
|
|
|
|
| 4 |
|
| 5 |
+
@app.get("/")
|
| 6 |
+
def read_root():
|
| 7 |
+
return {"Hello": "World!"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dockerfile
CHANGED
|
@@ -8,4 +8,4 @@ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
|
| 8 |
|
| 9 |
COPY . .
|
| 10 |
|
| 11 |
-
CMD ["uvicorn", "
|
|
|
|
| 8 |
|
| 9 |
COPY . .
|
| 10 |
|
| 11 |
+
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
README.md
CHANGED
|
@@ -4,6 +4,7 @@ emoji: 📊
|
|
| 4 |
colorFrom: green
|
| 5 |
colorTo: gray
|
| 6 |
sdk: docker
|
|
|
|
| 7 |
pinned: false
|
| 8 |
---
|
| 9 |
|
|
|
|
| 4 |
colorFrom: green
|
| 5 |
colorTo: gray
|
| 6 |
sdk: docker
|
| 7 |
+
app_port: 7860
|
| 8 |
pinned: false
|
| 9 |
---
|
| 10 |
|
requirements.txt
CHANGED
|
@@ -3,6 +3,4 @@ requests==2.27.*
|
|
| 3 |
sentencepiece==0.1.*
|
| 4 |
transformers==4.*
|
| 5 |
uvicorn[standard]==0.17.*
|
| 6 |
-
panel
|
| 7 |
-
hvplot
|
| 8 |
|
|
|
|
| 3 |
sentencepiece==0.1.*
|
| 4 |
transformers==4.*
|
| 5 |
uvicorn[standard]==0.17.*
|
|
|
|
|
|
|
| 6 |
|