Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,20 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import random as r
|
| 3 |
from huggingface_hub import InferenceClient
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
client = InferenceClient("microsoft/phi-4")
|
| 6 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import random as r
|
| 3 |
from huggingface_hub import InferenceClient
|
| 4 |
+
import pandas as pd
|
| 5 |
+
import numpy as np
|
| 6 |
+
import gradio as gr
|
| 7 |
+
from sklearn.metrics.pairwise import euclidean_distances
|
| 8 |
+
import openai
|
| 9 |
+
|
| 10 |
+
# --- Set your OpenAI API key ---
|
| 11 |
+
openai.api_key = "MY_TOKENN" # replace with your key
|
| 12 |
+
|
| 13 |
+
# --- Load your CSV ---
|
| 14 |
+
# Ensure your CSV has columns: 'song', 'artist', 'bpm', 'nrgy', 'dnce', 'dB', 'live', 'val', 'dur', 'acous', 'spch', 'pop'
|
| 15 |
+
df = pd.read_csv("datalab_export_2025-08-11 14_16_35.csv")
|
| 16 |
+
feature_cols = ['bpm', 'nrgy', 'dnce', 'dB', 'live', 'val', 'dur', 'acous', 'spch', 'pop']
|
| 17 |
+
df_features = df[feature_cols].astype(float)
|
| 18 |
|
| 19 |
client = InferenceClient("microsoft/phi-4")
|
| 20 |
|