ombhojane commited on
Commit
fb277e2
·
verified ·
1 Parent(s): 70fd1e6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -34
app.py CHANGED
@@ -55,39 +55,16 @@ def gradio_interface(land_size, biodiversity, budget, infrastructure):
55
  prediction = predict_service(land_size, biodiversity, budget, infrastructure)
56
  return f"The predicted service is: {prediction}"
57
 
58
- def show_price_guide():
59
- return """
60
- | Type | Target Audience | Price Range |
61
- |-----------|------------------------------------------------------|---------------------|
62
- | Economy | Budget travelers, local tourists, students. | 5,000 to 50,000 Rs. |
63
- | Mid-Range | Middle-class tourists, small groups, families. | 50,000 to 2,00,000 Rs. |
64
- | Luxury | High-end tourists, international visitors, corporate groups. | 2,00,000 to 10,00,000 Rs. |
65
- """
66
 
 
 
 
 
 
 
 
 
 
 
67
 
68
-
69
- iface = gr.Interface(
70
- fn=gradio_interface,
71
- inputs=[
72
- gr.Number(label="Land Size (acres)"),
73
- gr.Dropdown(label="Biodiversity", choices=df['Biodiversity'].unique().tolist()),
74
- gr.Number(label="Budget (INR)"),
75
- gr.Dropdown(label="Existing Infrastructure", choices=df['Existing Infrastructure'].unique().tolist()),
76
- gr.Button("Show Budget Guide")
77
- ],
78
- outputs=[
79
- gr.Text(label="Predicted Service"),
80
- gr.Markdown(label="Budget Guide", visible=False) # Initially hidden
81
- ],
82
- title="Service Prediction Model",
83
- description="Select land size, biodiversity, budget, and existing infrastructure to predict the service.",
84
- theme="default" # Set the theme color here
85
- )
86
-
87
- # Update the interface to show the price guide when the button is clicked
88
- iface.update(
89
- components=[None, None, None, None, None, show_price_guide()], # Matching the inputs plus the function for guide
90
- outputs=[None, "visible"] # Only update the visibility of the Markdown component
91
- )
92
-
93
- iface.launch()
 
55
  prediction = predict_service(land_size, biodiversity, budget, infrastructure)
56
  return f"The predicted service is: {prediction}"
57
 
 
 
 
 
 
 
 
 
58
 
59
+ iface = gr.Interface(fn=gradio_interface,
60
+ inputs=[
61
+ gr.Number(label="Land Size (acres)"),
62
+ gr.Dropdown(label="Biodiversity", choices=df['Biodiversity'].unique().tolist()),
63
+ gr.Number(label="Budget (INR)"),
64
+ gr.Dropdown(label="Existing Infrastructure", choices=df['Existing Infrastructure'].unique().tolist())
65
+ ],
66
+ outputs=gr.Text(label="Predicted Service"),
67
+ title="Service Prediction Model",
68
+ description="Select land size, biodiversity, budget, and existing infrastructure to predict the service.")
69
 
70
+ iface.launch()