Spaces:
Paused
Paused
Abid
commited on
Commit
•
8c32d7f
1
Parent(s):
9577c2f
gradio app added
Browse files- .dvc/config +2 -0
- .slugignore +0 -0
- Procfile +1 -0
- app_table.py +36 -0
- flagged/log.csv +4 -0
- requirements.txt +12 -9
- setup.sh +2 -0
.dvc/config
CHANGED
@@ -3,3 +3,5 @@
|
|
3 |
remote = origin
|
4 |
['remote "origin"']
|
5 |
url = https://dagshub.com/OperationSavta/SavtaDepth.dvc
|
|
|
|
|
|
3 |
remote = origin
|
4 |
['remote "origin"']
|
5 |
url = https://dagshub.com/OperationSavta/SavtaDepth.dvc
|
6 |
+
['remote "upstream"']
|
7 |
+
url = https://dagshub.com/OperationSavta/SavtaDepth.dvc
|
.slugignore
ADDED
File without changes
|
Procfile
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
web: source setup.sh && python app_table.py
|
app_table.py
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import matplotlib.pyplot as plt
|
2 |
+
import numpy as np
|
3 |
+
import pandas as pd
|
4 |
+
|
5 |
+
import gradio as gr
|
6 |
+
|
7 |
+
|
8 |
+
def sales_projections(employee_data):
|
9 |
+
sales_data = employee_data.iloc[:, 1:4].astype("int").to_numpy()
|
10 |
+
regression_values = np.apply_along_axis(
|
11 |
+
lambda row: np.array(np.poly1d(np.polyfit([0, 1, 2], row, 2))), 0, sales_data
|
12 |
+
)
|
13 |
+
projected_months = np.repeat(
|
14 |
+
np.expand_dims(np.arange(3, 12), 0), len(sales_data), axis=0
|
15 |
+
)
|
16 |
+
projected_values = np.array(
|
17 |
+
[
|
18 |
+
month * month * regression[0] + month * regression[1] + regression[2]
|
19 |
+
for month, regression in zip(projected_months, regression_values)
|
20 |
+
]
|
21 |
+
)
|
22 |
+
plt.plot(projected_values.T)
|
23 |
+
plt.legend(employee_data["Name"])
|
24 |
+
return employee_data, plt.gcf(), regression_values
|
25 |
+
|
26 |
+
|
27 |
+
iface = gr.Interface(
|
28 |
+
sales_projections,
|
29 |
+
gr.inputs.Dataframe(
|
30 |
+
headers=["Name", "Jan Sales", "Feb Sales", "Mar Sales"],
|
31 |
+
default=[["Jon", 12, 14, 18], ["Alice", 14, 17, 2], ["Sana", 8, 9.5, 12]],
|
32 |
+
),
|
33 |
+
["dataframe", "plot", "numpy"],
|
34 |
+
description="Enter sales figures for employees to predict sales trajectory over year.",
|
35 |
+
)
|
36 |
+
iface.launch(auth=("admin", "pass1234"))
|
flagged/log.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name,Output,timestamp
|
2 |
+
Google,Hello Google!,2022-02-09 18:25:43.892129
|
3 |
+
Google,Hello Google!,2022-02-09 18:25:45.867548
|
4 |
+
Google,Hello Google!,2022-02-09 18:25:52.447643
|
requirements.txt
CHANGED
@@ -1,10 +1,13 @@
|
|
1 |
-
dvc==1.11.15
|
2 |
-
fastai==2.2.5
|
3 |
-
torch==1.7.0
|
4 |
h5py==2.10.0
|
5 |
-
opencv-python==4.4.0.42
|
6 |
-
tqdm==4.52.0
|
7 |
-
numpy==1.19.4
|
8 |
-
scikit-learn==0.23.2
|
9 |
-
dagshub==0.1.6
|
10 |
-
tables==3.6.1
|
|
|
|
|
|
|
|
1 |
+
#dvc==1.11.15
|
2 |
+
#fastai==2.2.5
|
3 |
+
#torch==1.7.0
|
4 |
h5py==2.10.0
|
5 |
+
#opencv-python==4.4.0.42
|
6 |
+
#tqdm==4.52.0
|
7 |
+
#numpy==1.19.4
|
8 |
+
#scikit-learn==0.23.2
|
9 |
+
#dagshub==0.1.6
|
10 |
+
#tables==3.6.1
|
11 |
+
fastapi
|
12 |
+
gradio
|
13 |
+
uvicorn
|
setup.sh
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
export GRADIO_SERVER_NAME=0.0.0.0
|
2 |
+
export GRADIO_SERVER_PORT="$PORT"
|