Spaces:
Sleeping
Sleeping
Commit ·
4da9055
1
Parent(s): dc8754c
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,19 +1,21 @@
|
|
| 1 |
-
import gradio as gr
|
|
|
|
| 2 |
import pandas as pd
|
| 3 |
from sklearn.linear_model import LogisticRegression
|
| 4 |
|
| 5 |
def classify(data):
|
| 6 |
-
df = pd.read_csv(data)
|
| 7 |
X = df.drop('y', axis=1)
|
| 8 |
-
y = df['y']
|
| 9 |
|
| 10 |
model = LogisticRegression()
|
| 11 |
-
model.fit(X, y)
|
| 12 |
|
| 13 |
return model.predict(X)
|
| 14 |
|
| 15 |
-
demo = gr.Interface(fn=classify,
|
| 16 |
-
inputs=
|
| 17 |
-
outputs="label")
|
| 18 |
|
| 19 |
-
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from gradio.components import File
|
| 3 |
import pandas as pd
|
| 4 |
from sklearn.linear_model import LogisticRegression
|
| 5 |
|
| 6 |
def classify(data):
|
| 7 |
+
df = pd.read_csv(data)
|
| 8 |
X = df.drop('y', axis=1)
|
| 9 |
+
y = df['y']
|
| 10 |
|
| 11 |
model = LogisticRegression()
|
| 12 |
+
model.fit(X, y)
|
| 13 |
|
| 14 |
return model.predict(X)
|
| 15 |
|
| 16 |
+
demo = gr.Interface(fn=classify,
|
| 17 |
+
inputs=File(),
|
| 18 |
+
outputs="label")
|
| 19 |
|
| 20 |
+
if __name__ == "__main__":
|
| 21 |
+
demo.launch()
|