Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,43 +1,46 @@
|
|
| 1 |
import streamlit as st
|
|
|
|
| 2 |
import pandas as pd
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
{'name': '
|
| 13 |
-
{'name': '
|
| 14 |
-
{'name': '
|
| 15 |
-
{'name': '
|
|
|
|
| 16 |
]
|
| 17 |
|
| 18 |
-
#
|
| 19 |
-
|
| 20 |
-
|
| 21 |
|
| 22 |
# Define the Streamlit app
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
import plotly.express as px
|
| 3 |
import pandas as pd
|
| 4 |
+
|
| 5 |
+
# Define the Hugging Face model
|
| 6 |
+
@st.cache(allow_output_mutation=True)
|
| 7 |
+
def load_model():
|
| 8 |
+
model = <Hugging Face Model> # Replace with your own Hugging Face model
|
| 9 |
+
return model
|
| 10 |
+
|
| 11 |
+
# Define the top five largest hospitals in NJ
|
| 12 |
+
hospitals = [
|
| 13 |
+
{'name': 'Hackensack University Medical Center', 'beds': 974, 'latitude': 40.8875, 'longitude': -74.0344},
|
| 14 |
+
{'name': 'Robert Wood Johnson University Hospital', 'beds': 965, 'latitude': 40.4842, 'longitude': -74.4323},
|
| 15 |
+
{'name': 'Jersey Shore University Medical Center', 'beds': 621, 'latitude': 40.1876, 'longitude': -74.0575},
|
| 16 |
+
{'name': 'St. Joseph\'s University Medical Center', 'beds': 525, 'latitude': 40.9235, 'longitude': -74.1645},
|
| 17 |
+
{'name': 'Morristown Medical Center', 'beds': 506, 'latitude': 40.7878, 'longitude': -74.4873}
|
| 18 |
]
|
| 19 |
|
| 20 |
+
# Save the hospital data as a CSV file
|
| 21 |
+
df = pd.DataFrame(hospitals)
|
| 22 |
+
df.to_csv('hospitals.csv', index=False)
|
| 23 |
|
| 24 |
# Define the Streamlit app
|
| 25 |
+
def app():
|
| 26 |
+
st.title('Hospital Data')
|
| 27 |
+
|
| 28 |
+
# Load the Hugging Face model
|
| 29 |
+
model = load_model()
|
| 30 |
+
|
| 31 |
+
# Get user input
|
| 32 |
+
text = st.text_input('Enter text to summarize')
|
| 33 |
+
|
| 34 |
+
# Generate summary using the Hugging Face model
|
| 35 |
+
summary = model(text)
|
| 36 |
+
|
| 37 |
+
# Display the summary
|
| 38 |
+
st.write('Summary:', summary)
|
| 39 |
+
|
| 40 |
+
# Create a treemap of the hospital data
|
| 41 |
+
fig = px.treemap(df, path=['name'], values='beds', color='beds', hover_data=['latitude', 'longitude'])
|
| 42 |
+
st.plotly_chart(fig)
|
| 43 |
+
|
| 44 |
+
# Run the Streamlit app
|
| 45 |
+
if __name__ == '__main__':
|
| 46 |
+
app()
|