Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -129,7 +129,7 @@ def predict_single_text(text):
|
|
129 |
predicted_prob = [round(a_, 3) for a_ in probabilities.cpu().numpy().tolist() if a_ > threshold]
|
130 |
|
131 |
# Create a dictionary containing the top predicted IEQ labels and their corresponding probabilities
|
132 |
-
top_prediction = predicted_labels
|
133 |
|
134 |
# Create a bar chart showing the likelihood of each IEQ label
|
135 |
# Make dataframe for plotly bar chart
|
@@ -141,14 +141,14 @@ def predict_single_text(text):
|
|
141 |
df2['Likelihood'] = n
|
142 |
|
143 |
# plot graph of predictions
|
144 |
-
fig = px.bar(df2, x="Likelihood", y="IEQ", orientation="
|
145 |
|
146 |
fig.update_layout(
|
147 |
# barmode='stack',
|
148 |
template='seaborn', font=dict(family="Arial", size=12, color="black"),
|
149 |
autosize=True,
|
150 |
-
|
151 |
-
|
152 |
xaxis_title="Likelihood of IEQ",
|
153 |
yaxis_title="Indoor environmental quality (IEQ)",
|
154 |
# legend_title="Topics"
|
|
|
129 |
predicted_prob = [round(a_, 3) for a_ in probabilities.cpu().numpy().tolist() if a_ > threshold]
|
130 |
|
131 |
# Create a dictionary containing the top predicted IEQ labels and their corresponding probabilities
|
132 |
+
top_prediction = (dict(zip(predicted_labels, predicted_prob)))
|
133 |
|
134 |
# Create a bar chart showing the likelihood of each IEQ label
|
135 |
# Make dataframe for plotly bar chart
|
|
|
141 |
df2['Likelihood'] = n
|
142 |
|
143 |
# plot graph of predictions
|
144 |
+
fig = px.bar(df2, x="Likelihood", y="IEQ", orientation="h")
|
145 |
|
146 |
fig.update_layout(
|
147 |
# barmode='stack',
|
148 |
template='seaborn', font=dict(family="Arial", size=12, color="black"),
|
149 |
autosize=True,
|
150 |
+
width=800,
|
151 |
+
height=500,
|
152 |
xaxis_title="Likelihood of IEQ",
|
153 |
yaxis_title="Indoor environmental quality (IEQ)",
|
154 |
# legend_title="Topics"
|