saaara commited on
Commit
3e8bc2f
1 Parent(s): 361dc30

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -2
app.py CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
2
  import numpy as np
3
  import pandas as pd
4
  import tensorflow as tf
 
5
 
6
  # Load the trained model
7
  model = tf.keras.models.load_model('real_estate_price_prediction_model.h5')
@@ -59,11 +60,14 @@ def predict_price(surface, pieces, chambres, sdb, age, etage, etat_Bon_état, et
59
 
60
  return f"Predicted price: {predicted_price[0][0]}"
61
 
 
 
 
62
  # Gradio interface setup
63
  interface = gr.Interface(
64
  fn=predict_price, # The function to be called with user input
65
  inputs=[
66
- gr.Slider(label=f"Enter value for 'surface'", minimum=0, maximum=500, step=1),
67
  gr.Slider(label=f"Enter value for 'pieces'", minimum=0, maximum=15, step=1),
68
  gr.Slider(label=f"Enter value for 'chambres'", minimum=0, maximum=10, step=1),
69
  gr.Slider(label=f"Enter value for 'sdb'", minimum=0, maximum=5, step=1),
@@ -75,7 +79,14 @@ interface = gr.Interface(
75
  gr.Textbox(label=f"Enter value for 'secteur'", type="text"),
76
  gr.Textbox(label=f"Enter value for 'city'", type="text")
77
  ],
78
- outputs=gr.Textbox(label="Predicted Price(Dh):", interactive=False)
 
 
 
 
 
 
 
79
  )
80
 
81
  # Launch the Gradio interface
 
2
  import numpy as np
3
  import pandas as pd
4
  import tensorflow as tf
5
+ from IPython.display import HTML
6
 
7
  # Load the trained model
8
  model = tf.keras.models.load_model('real_estate_price_prediction_model.h5')
 
60
 
61
  return f"Predicted price: {predicted_price[0][0]}"
62
 
63
+ # Create HTML code to display an image
64
+ image_html = "<img src='/content/Capture d’écran 2024-01-28 155359.jpg' style='max-width:100%;'>"
65
+
66
  # Gradio interface setup
67
  interface = gr.Interface(
68
  fn=predict_price, # The function to be called with user input
69
  inputs=[
70
+ gr.Slider(label=f"Enter value for 'surface(m²)'", minimum=0, maximum=500, step=1),
71
  gr.Slider(label=f"Enter value for 'pieces'", minimum=0, maximum=15, step=1),
72
  gr.Slider(label=f"Enter value for 'chambres'", minimum=0, maximum=10, step=1),
73
  gr.Slider(label=f"Enter value for 'sdb'", minimum=0, maximum=5, step=1),
 
79
  gr.Textbox(label=f"Enter value for 'secteur'", type="text"),
80
  gr.Textbox(label=f"Enter value for 'city'", type="text")
81
  ],
82
+ outputs=gr.Textbox(label="Predicted Price(Dh):", interactive=False),
83
+ title="Real Estate Price Prediction",
84
+ description="Enter property details to predict its price.",
85
+ examples=[
86
+ [250, 5, 3, 2, 10, 3, 1, 0, 0, "'Secteur_A'", "'City_X'"],
87
+ [150, 4, 2, 1, 5, 2, 1, 0, 0, "'Secteur_B'", "'City_Y'"]
88
+ ],
89
+ theme="compact", # Compact theme for a cleaner look
90
  )
91
 
92
  # Launch the Gradio interface