Spotify / app.py
GouthamVarma's picture
Upload 2 files
d49e583 verified
raw
history blame
700 Bytes
import gradio as gr
import pandas as pd
import numpy as np
from sklearn.decomposition import TruncatedSVD
import time
from model import MatrixFactorization, create_gradio_interface
try:
# Load the preprocessed data
print("Loading data...")
df = pd.read_csv('data.csv')
# Initialize and train the model
print("Initializing model...")
mf_recommender = MatrixFactorization(n_factors=50) # Reduced for speed
mf_recommender.fit(df)
# Create and launch the Gradio interface
print("Creating interface...")
demo = create_gradio_interface(mf_recommender)
demo.launch(share=True)
except Exception as e:
print(f"Error: {str(e)}")