Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -55,7 +55,7 @@ def create_prediction_interface(model, scaler, features_mapping, data):
|
|
| 55 |
input_values = pd.DataFrame([args], columns=nasa_features)
|
| 56 |
input_values_scaled = scaler.transform(input_values)
|
| 57 |
prediction = model.predict(input_values_scaled)
|
| 58 |
-
return round(prediction[0], 2)
|
| 59 |
|
| 60 |
with gr.Blocks(theme=gr.themes.Default()) as demo:
|
| 61 |
gr.Markdown("### Stock Price Prediction")
|
|
@@ -82,7 +82,7 @@ def create_prediction_interface(model, scaler, features_mapping, data):
|
|
| 82 |
|
| 83 |
with gr.Column(scale=1):
|
| 84 |
gr.Markdown("#### Predicted Result", elem_id="result-header")
|
| 85 |
-
output = gr.
|
| 86 |
predict_btn.click(fn=predict_func, inputs=inputs, outputs=output)
|
| 87 |
|
| 88 |
return demo
|
|
@@ -91,4 +91,4 @@ if __name__ == "__main__":
|
|
| 91 |
X_train_scaled, X_test_scaled, y_train, y_test, scaler, nasa_features, data = load_and_prepare_data()
|
| 92 |
model = train_model(X_train_scaled, y_train)
|
| 93 |
demo = create_prediction_interface(model, scaler, data_mapping, data)
|
| 94 |
-
demo.launch()
|
|
|
|
| 55 |
input_values = pd.DataFrame([args], columns=nasa_features)
|
| 56 |
input_values_scaled = scaler.transform(input_values)
|
| 57 |
prediction = model.predict(input_values_scaled)
|
| 58 |
+
return f"${round(prediction[0], 2)} USD"
|
| 59 |
|
| 60 |
with gr.Blocks(theme=gr.themes.Default()) as demo:
|
| 61 |
gr.Markdown("### Stock Price Prediction")
|
|
|
|
| 82 |
|
| 83 |
with gr.Column(scale=1):
|
| 84 |
gr.Markdown("#### Predicted Result", elem_id="result-header")
|
| 85 |
+
output = gr.Textbox(label="Predicted Close_^FTSE", interactive=False, value="$0.00 USD")
|
| 86 |
predict_btn.click(fn=predict_func, inputs=inputs, outputs=output)
|
| 87 |
|
| 88 |
return demo
|
|
|
|
| 91 |
X_train_scaled, X_test_scaled, y_train, y_test, scaler, nasa_features, data = load_and_prepare_data()
|
| 92 |
model = train_model(X_train_scaled, y_train)
|
| 93 |
demo = create_prediction_interface(model, scaler, data_mapping, data)
|
| 94 |
+
demo.launch()
|