alidenewade commited on
Commit
230669a
·
verified ·
1 Parent(s): fdb08a0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -55,8 +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
- # Format the prediction as USD with two decimal places
59
- return f"${round(prediction[0], 2):.2f}"
60
 
61
  with gr.Blocks(theme=gr.themes.Default()) as demo:
62
  gr.Markdown("### Stock Price Prediction")
@@ -82,9 +81,8 @@ def create_prediction_interface(model, scaler, features_mapping, data):
82
  predict_btn = gr.Button("Predict", variant="primary")
83
 
84
  with gr.Column(scale=1):
85
- gr.Markdown("#### Predicted Result")
86
- # Use TextOutput to display the formatted USD value
87
- output = gr.TextOutput(label="Predicted Close_^FTSE", value="0.00", interactive=False)
88
  predict_btn.click(fn=predict_func, inputs=inputs, outputs=output)
89
 
90
  return demo
 
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)}" # Format the prediction with a dollar sign
 
59
 
60
  with gr.Blocks(theme=gr.themes.Default()) as demo:
61
  gr.Markdown("### Stock Price Prediction")
 
81
  predict_btn = gr.Button("Predict", variant="primary")
82
 
83
  with gr.Column(scale=1):
84
+ gr.Markdown("#### Predicted Result", elem_id="result-header")
85
+ output = gr.Markdown(label="Predicted Close_^FTSE", interactive=False, value="$0.00") # Change to Markdown and add $
 
86
  predict_btn.click(fn=predict_func, inputs=inputs, outputs=output)
87
 
88
  return demo