File size: 915 Bytes
3f94b22
690da07
 
0324c49
3f94b22
 
 
690da07
 
352a337
3f94b22
 
690da07
3f94b22
 
 
 
 
 
 
 
 
 
 
 
690da07
 
3f94b22
690da07
3f94b22
690da07
3f94b22
690da07
3f94b22
690da07
3c44e71
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import pandas as pd
import subprocess
subprocess.call(["pip", "install", "scikit-learn"])
subprocess.call(["python", "-m", "pip" ,"install", "--upgrade pip"])
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
import numpy as np

import gradio as gr
#ooooo

df=pd.read_csv('GOOG.csv')
y=df['Close']
p=df.drop('Close',axis=1)
q=p.drop('Date',axis=1)
gw=q.drop('High',axis=1)
g=q.drop('Adj Close',axis=1)
x=g

x_train,x_test,y_train,y_test = train_test_split(x,y,test_size=0.2,random_state=100)

lr=LinearRegression()
lr.fit(x_train,y_train)
y_lr_train_pred=lr.predict(x_train)
y_lr_test_pred=lr.predict(x_test)
def pre(features):
    a = np.array(list(map(float, features.split(","))))

    a_reshaped = a.reshape(1, -1)

    prediction = lr.predict(a_reshaped)

    return prediction[0]

iface = gr.Interface(fn=pre, inputs="text", outputs="text")
iface.launch()