Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -25,7 +25,7 @@ def process_csv(file):
|
|
| 25 |
|
| 26 |
# Get predicted classes
|
| 27 |
_, predicted_classes = torch.max(outputs.logits, dim=1)
|
| 28 |
-
df['predicted_class'] = predicted_classes.numpy()
|
| 29 |
|
| 30 |
# Return the processed DataFrame as a CSV string
|
| 31 |
return df.to_csv(index=False)
|
|
@@ -35,12 +35,12 @@ def process_csv(file):
|
|
| 35 |
|
| 36 |
# Create the Gradio interface
|
| 37 |
input_csv = gr.File(label="Upload CSV File")
|
| 38 |
-
output_csv = gr.
|
| 39 |
|
| 40 |
demo = gr.Interface(
|
| 41 |
fn=process_csv,
|
| 42 |
inputs=input_csv,
|
| 43 |
-
outputs=
|
| 44 |
title="CSV Data Processing with TinyBERT",
|
| 45 |
description="Upload a CSV file with a 'text' column, and the model will process the data and provide predictions."
|
| 46 |
)
|
|
|
|
| 25 |
|
| 26 |
# Get predicted classes
|
| 27 |
_, predicted_classes = torch.max(outputs.logits, dim=1)
|
| 28 |
+
df['predicted_class'] = predicted_classes.numpy()
|
| 29 |
|
| 30 |
# Return the processed DataFrame as a CSV string
|
| 31 |
return df.to_csv(index=False)
|
|
|
|
| 35 |
|
| 36 |
# Create the Gradio interface
|
| 37 |
input_csv = gr.File(label="Upload CSV File")
|
| 38 |
+
output_csv = gr.Textbox(label="Output")
|
| 39 |
|
| 40 |
demo = gr.Interface(
|
| 41 |
fn=process_csv,
|
| 42 |
inputs=input_csv,
|
| 43 |
+
outputs=output_csv,
|
| 44 |
title="CSV Data Processing with TinyBERT",
|
| 45 |
description="Upload a CSV file with a 'text' column, and the model will process the data and provide predictions."
|
| 46 |
)
|