File size: 661 Bytes
81b661c
 
 
 
 
f80207b
81b661c
d49e583
 
 
 
 
f7c6ca0
d49e583
 
 
f80207b
 
 
 
 
f7c6ca0
d49e583
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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:
    print("Loading data...")
    df = pd.read_csv('data.csv')
    
    print("Initializing model...")
    mf_recommender = MatrixFactorization(n_factors=100)
    mf_recommender.fit(df)
    
    print("Creating interface...")
    demo = create_gradio_interface(mf_recommender)
    if demo is not None:
        demo.launch(share=False)
    else:
        print("Error: Interface creation failed")
    
except Exception as e:
    print(f"Error: {str(e)}")