Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,3 @@
|
|
1 |
-
# @title Define the application
|
2 |
-
|
3 |
import time
|
4 |
import random
|
5 |
import gradio as gr
|
@@ -1144,10 +1142,12 @@ def predict(dataset, attributes, access_token):
|
|
1144 |
predictions_count = len(prediction_results)
|
1145 |
accuracy = random.uniform(0.85, 0.95)
|
1146 |
prediction_message = f"{predictions_count} predictions made in {elapsed_time:.2f} seconds with an accuracy of {accuracy:.2f}%"
|
|
|
|
|
1147 |
else:
|
1148 |
prediction_message = "Failed to make predictions."
|
1149 |
prediction_results = pd.DataFrame([])
|
1150 |
-
|
1151 |
return prediction_message, prediction_results
|
1152 |
|
1153 |
|
@@ -1167,9 +1167,6 @@ def load_dataset_and_predict(dataset, attributes, access_token):
|
|
1167 |
|
1168 |
return loaded_data, prediction_message, code_example
|
1169 |
|
1170 |
-
|
1171 |
-
def download_prediction(dataset_preview):
|
1172 |
-
return
|
1173 |
|
1174 |
theme = gr.themes.Default().set(
|
1175 |
loader_color="#505AE7",
|
|
|
|
|
|
|
1 |
import time
|
2 |
import random
|
3 |
import gradio as gr
|
|
|
1142 |
predictions_count = len(prediction_results)
|
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("/file/prediction.csv", index=False)
|
1147 |
else:
|
1148 |
prediction_message = "Failed to make predictions."
|
1149 |
prediction_results = pd.DataFrame([])
|
1150 |
+
|
1151 |
return prediction_message, prediction_results
|
1152 |
|
1153 |
|
|
|
1167 |
|
1168 |
return loaded_data, prediction_message, code_example
|
1169 |
|
|
|
|
|
|
|
1170 |
|
1171 |
theme = gr.themes.Default().set(
|
1172 |
loader_color="#505AE7",
|