Update app.py
Browse files
app.py
CHANGED
@@ -220,3 +220,33 @@ iface = gr.Interface(
|
|
220 |
|
221 |
# Launch the app
|
222 |
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
|
221 |
# Launch the app
|
222 |
iface.launch()
|
223 |
+
from tensorflow.keras.models import Sequential
|
224 |
+
from tensorflow.keras.layers import Dense, Input
|
225 |
+
|
226 |
+
def create_model(input_shape):
|
227 |
+
model = Sequential()
|
228 |
+
model.add(Input(shape=(input_shape,))) # Explicitly define input shape
|
229 |
+
model.add(Dense(64, activation='relu'))
|
230 |
+
model.add(Dense(32, activation='relu'))
|
231 |
+
model.add(Dense(1, activation='sigmoid'))
|
232 |
+
|
233 |
+
model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])
|
234 |
+
return model
|
235 |
+
data.loc[:, 'Target'] = np.where(data['Close'].shift(-1) > data['Close'], 1, 0)
|
236 |
+
import gradio as gr
|
237 |
+
|
238 |
+
def predict_stock(ticker, start_date, end_date):
|
239 |
+
# Your prediction logic
|
240 |
+
return "Prediction result"
|
241 |
+
|
242 |
+
interface = gr.Interface(
|
243 |
+
fn=predict_stock,
|
244 |
+
inputs=[
|
245 |
+
gr.inputs.Dropdown(['AAPL', 'MSFT', 'GOOG', 'AMZN', 'TSLA'], label="Stock Ticker"),
|
246 |
+
gr.inputs.Date(label="Start Date"), # Replace DatePicker with Date
|
247 |
+
gr.inputs.Date(label="End Date")
|
248 |
+
],
|
249 |
+
outputs="text"
|
250 |
+
)
|
251 |
+
|
252 |
+
interface.launch()
|