Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1143,7 +1143,7 @@ def predict(dataset, attributes, access_token):
|
|
1143 |
accuracy = random.uniform(0.85, 0.95)
|
1144 |
prediction_message = f"{predictions_count} predictions made in {elapsed_time:.2f} seconds with an accuracy of {accuracy:.2f}%"
|
1145 |
|
1146 |
-
prediction_results.to_csv("
|
1147 |
else:
|
1148 |
prediction_message = "Failed to make predictions."
|
1149 |
prediction_results = pd.DataFrame([])
|
@@ -1208,7 +1208,7 @@ with gr.Blocks(theme=theme) as demo:
|
|
1208 |
code_example = gr.Code(language="python")
|
1209 |
|
1210 |
predict_button = gr.Button("Predict Attributes")
|
1211 |
-
download_button = gr.DownloadButton(label=f"Download Prediction", value="/
|
1212 |
|
1213 |
selected_dataset.change(
|
1214 |
fn=load_dataset,
|
@@ -1234,4 +1234,4 @@ with gr.Blocks(theme=theme) as demo:
|
|
1234 |
outputs=[dataset_preview, prediction_label, code_example],
|
1235 |
)
|
1236 |
|
1237 |
-
demo.launch(allowed_paths=["/
|
|
|
1143 |
accuracy = random.uniform(0.85, 0.95)
|
1144 |
prediction_message = f"{predictions_count} predictions made in {elapsed_time:.2f} seconds with an accuracy of {accuracy:.2f}%"
|
1145 |
|
1146 |
+
prediction_results.to_csv("prediction.csv", index=False)
|
1147 |
else:
|
1148 |
prediction_message = "Failed to make predictions."
|
1149 |
prediction_results = pd.DataFrame([])
|
|
|
1208 |
code_example = gr.Code(language="python")
|
1209 |
|
1210 |
predict_button = gr.Button("Predict Attributes")
|
1211 |
+
download_button = gr.DownloadButton(label=f"Download Prediction", value="/prediction.csv")
|
1212 |
|
1213 |
selected_dataset.change(
|
1214 |
fn=load_dataset,
|
|
|
1234 |
outputs=[dataset_preview, prediction_label, code_example],
|
1235 |
)
|
1236 |
|
1237 |
+
demo.launch(allowed_paths=["/prediction.csv"])
|