ogegadavis254 commited on
Commit
251086d
1 Parent(s): 717bb30

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -13
app.py CHANGED
@@ -5,6 +5,7 @@ import json
5
  import pandas as pd
6
  import folium
7
  from streamlit_folium import folium_static
 
8
 
9
  # Function to call the Together AI model
10
  def call_ai_model(all_message):
@@ -48,27 +49,16 @@ air_quality_index = st.number_input("Air Quality Index:", min_value=0, max_value
48
  precipitation = st.number_input("Precipitation (mm):", min_value=0.0, max_value=500.0, value=10.0)
49
  atmospheric_pressure = st.number_input("Atmospheric Pressure (hPa):", min_value=900, max_value=1100, value=1013)
50
 
51
- # Geographic location
52
  latitude = st.number_input("Latitude:", min_value=-90.0, max_value=90.0, value=0.0)
53
  longitude = st.number_input("Longitude:", min_value=-180.0, max_value=180.0, value=0.0)
54
 
55
- # Athlete-specific data
56
- age = st.number_input("Athlete Age:", min_value=0, max_value=100, value=25)
57
- sport = st.selectbox("Select Sport:", ["Running", "Cycling", "Swimming", "Football", "Basketball"])
58
- performance_history = st.text_area("Athlete Performance History:")
59
-
60
- # Infrastructure characteristics
61
- facility_type = st.selectbox("Facility Type:", ["Stadium", "Gymnasium", "Outdoor Field"])
62
- facility_age = st.number_input("Facility Age (years):", min_value=0, max_value=100, value=10)
63
- materials_used = st.text_input("Materials Used in Construction:")
64
-
65
  if st.button("Generate Prediction"):
66
  all_message = (
67
  f"Assess the impact on sports performance and infrastructure based on climate conditions: "
68
  f"Temperature {temperature}°C, Humidity {humidity}%, Wind Speed {wind_speed} km/h, UV Index {uv_index}, "
69
  f"Air Quality Index {air_quality_index}, Precipitation {precipitation} mm, Atmospheric Pressure {atmospheric_pressure} hPa. "
70
- f"Location: Latitude {latitude}, Longitude {longitude}. "
71
- f"Athlete (Age: {age}, Sport: {sport}), Facility (Type: {facility_type}, Age: {facility_age}, Materials: {materials_used})."
72
  )
73
 
74
  try:
@@ -107,6 +97,13 @@ if st.button("Generate Prediction"):
107
  st.markdown("**Predicted Impact on Performance and Infrastructure:**")
108
  st.markdown(generated_text.strip())
109
 
 
 
 
 
 
 
 
110
  # Generate static map using Folium
111
  map_center = [latitude, longitude]
112
  sport_map = folium.Map(location=map_center, zoom_start=12)
 
5
  import pandas as pd
6
  import folium
7
  from streamlit_folium import folium_static
8
+ import matplotlib.pyplot as plt
9
 
10
  # Function to call the Together AI model
11
  def call_ai_model(all_message):
 
49
  precipitation = st.number_input("Precipitation (mm):", min_value=0.0, max_value=500.0, value=10.0)
50
  atmospheric_pressure = st.number_input("Atmospheric Pressure (hPa):", min_value=900, max_value=1100, value=1013)
51
 
52
+ # Geographic location input
53
  latitude = st.number_input("Latitude:", min_value=-90.0, max_value=90.0, value=0.0)
54
  longitude = st.number_input("Longitude:", min_value=-180.0, max_value=180.0, value=0.0)
55
 
 
 
 
 
 
 
 
 
 
 
56
  if st.button("Generate Prediction"):
57
  all_message = (
58
  f"Assess the impact on sports performance and infrastructure based on climate conditions: "
59
  f"Temperature {temperature}°C, Humidity {humidity}%, Wind Speed {wind_speed} km/h, UV Index {uv_index}, "
60
  f"Air Quality Index {air_quality_index}, Precipitation {precipitation} mm, Atmospheric Pressure {atmospheric_pressure} hPa. "
61
+ f"Location: Latitude {latitude}, Longitude {longitude}."
 
62
  )
63
 
64
  try:
 
97
  st.markdown("**Predicted Impact on Performance and Infrastructure:**")
98
  st.markdown(generated_text.strip())
99
 
100
+ # Generate a simple chart
101
+ fig, ax = plt.subplots()
102
+ ax.bar(results_data['Condition'], results_data['Value'])
103
+ ax.set_ylabel('Values')
104
+ ax.set_title('Climate Conditions Impact')
105
+ st.pyplot(fig)
106
+
107
  # Generate static map using Folium
108
  map_center = [latitude, longitude]
109
  sport_map = folium.Map(location=map_center, zoom_start=12)