Skip to content

Commit

Permalink
Update app.py
Browse files Browse the repository at this point in the history
  • Loading branch information
canstralian authored Feb 2, 2025
1 parent 6aeaf91 commit 4a22cf5
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@
from data.preprocess import load_data, preprocess_data, save_processed_data

def prepare_and_train(model_name, dataset_path, epochs, batch_size, learning_rate):
# Load and preprocess the dataset
data = load_data(dataset_path)
cleaned_data = preprocess_data(data)
processed_data_path = 'data/processed/processed_dataset.csv'
save_processed_data(cleaned_data, processed_data_path)
try:
# Load and preprocess the dataset
data = load_data(dataset_path)
cleaned_data = preprocess_data(data)
processed_data_path = 'data/processed/processed_dataset.csv'
save_processed_data(cleaned_data, processed_data_path)

# Proceed with model fine-tuning
return fine_tune(model_name, dataset_url=None, file=processed_data_path, epochs=epochs, batch_size=batch_size, learning_rate=learning_rate)
# Proceed with model fine-tuning
return fine_tune(model_name, dataset_url=None, file=processed_data_path, epochs=epochs, batch_size=batch_size, learning_rate=learning_rate)
except Exception as e:
print(f"Error occurred: {e}")
return str(e)

iface = gr.Interface(
fn=prepare_and_train,
Expand All @@ -26,4 +30,4 @@ def prepare_and_train(model_name, dataset_path, epochs, batch_size, learning_rat
)

if __name__ == "__main__":
iface.launch()
iface.launch()

0 comments on commit 4a22cf5

Please sign in to comment.