Spaces:
Runtime error
Runtime error
first deploy
Browse files- app.py +25 -4
- requirements.txt +3 -0
- test_df.xlsx +0 -0
- test_model.pkl +0 -0
app.py
CHANGED
@@ -1,8 +1,29 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
2 |
|
3 |
-
def greet(name):
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
7 |
-
iface.launch()
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
import pandas as pd
|
3 |
+
import numpy as np
|
4 |
+
import pickle
|
5 |
|
|
|
|
|
6 |
|
7 |
+
remote_df = pd.read_excel('test_df.xlsx')
|
|
|
8 |
|
9 |
+
def predict(x1, x2):
|
10 |
+
|
11 |
+
X = np.array([x1, x2], ndmin = 2)
|
12 |
+
|
13 |
+
with open('test_model.pkl', 'rb') as model:
|
14 |
+
clf = pickle.load(model)
|
15 |
+
|
16 |
+
y_pred = clf.predict(X)
|
17 |
+
|
18 |
+
return y_pred + remote_df['col1'][0]
|
19 |
+
|
20 |
+
demo = gr.Interface(
|
21 |
+
predict,
|
22 |
+
inputs = [gr.Number(), gr.Number()],
|
23 |
+
outputs = gr.Number(),
|
24 |
+
examples=[
|
25 |
+
],
|
26 |
+
title = 'Deploy Test'
|
27 |
+
)
|
28 |
+
|
29 |
+
demo.launch(share = True)
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
pandas
|
2 |
+
numpy
|
3 |
+
pickle
|
test_df.xlsx
ADDED
Binary file (4.91 kB). View file
|
|
test_model.pkl
ADDED
Binary file (2.76 kB). View file
|
|