Matan Kriel commited on
Commit
bb866b9
Β·
1 Parent(s): 0c8eab5

updated readme and app

Browse files
Files changed (2) hide show
  1. README.md +2 -21
  2. app.py +4 -4
README.md CHANGED
@@ -11,7 +11,7 @@ pinned: false
11
 
12
  # πŸš€ Social Media Virality Assistant
13
 
14
- A machine learning-powered tool that helps content creators predict and optimize their video virality potential using **XGBoost** and **Google Gemini AI**.
15
 
16
  ## πŸ—οΈ Architecture & Pipeline
17
 
@@ -42,7 +42,7 @@ The `app.py` script runs a **Gradio** web interface that pulls artifacts from th
42
  * Generates embeddings on-the-fly for the Knowledge Base.
43
  2. **Core Features**:
44
  * **Virality Prediction**: Predicts raw view counts based on your draft description and stats.
45
- * **AI Optimization**: Uses **Google Gemini** to rewrite your description with viral hooks and hashtags.
46
  * **Semantic Search**: Finds similar successful videos from the knowledge base using Cosine Similarity.
47
 
48
  ---
@@ -70,22 +70,3 @@ This project is built using:
70
 
71
  ---
72
 
73
- ## πŸš€ How to Run
74
-
75
- 1. **Install Dependencies**:
76
- ```bash
77
- pip install -r requirements.txt
78
- ```
79
-
80
- 2. **Run the App**:
81
- The app will automatically download the necessary data and models from Hugging Face.
82
- ```bash
83
- export GEMINI_API_KEY="your_api_key_here"
84
- python app.py
85
- ```
86
-
87
- 3. **(Optional) Retrain the Model**:
88
- If you want to re-run the benchmarks and training using the latest data:
89
- ```bash
90
- python model-prep.py
91
- ```
 
11
 
12
  # πŸš€ Social Media Virality Assistant
13
 
14
+ A machine learning-powered tool that helps content creators predict and optimize their video virality potential using trained **XGBoost** model and **Google Gemini AI**.
15
 
16
  ## πŸ—οΈ Architecture & Pipeline
17
 
 
42
  * Generates embeddings on-the-fly for the Knowledge Base.
43
  2. **Core Features**:
44
  * **Virality Prediction**: Predicts raw view counts based on your draft description and stats.
45
+ * **AI Optimization**: Uses **Google Gemini** to rewrite your description with viral hooks and hashtags with the context of top 3 similar videos from the dataset.
46
  * **Semantic Search**: Finds similar successful videos from the knowledge base using Cosine Similarity.
47
 
48
  ---
 
70
 
71
  ---
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app.py CHANGED
@@ -38,7 +38,7 @@ def initialize_app():
38
  except Exception as e:
39
  raise RuntimeError(f"Failed to load dataset from HF: {e}")
40
 
41
- # 2. FIT ENCODERS (Crucial for Feature Consistency)
42
  print("πŸ”€ Fitting Label Encoders...")
43
  cat_cols = ['category', 'gender', 'day_of_week', 'age']
44
  for c in cat_cols:
@@ -76,7 +76,7 @@ def initialize_app():
76
  device = "mps" if torch.backends.mps.is_available() else "cpu"
77
  st_model = SentenceTransformer(embedding_model_name, device=device)
78
 
79
- # 5. Generate Embeddings (On-the-fly)
80
  print("βš™οΈ Generating Embeddings for Knowledge Base (One-time setup)...")
81
  if 'embedding' not in knowledge_df.columns:
82
  embeddings = st_model.encode(knowledge_df['description'].fillna("").tolist(),
@@ -257,12 +257,12 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
257
 
258
  # Demo Button Logic
259
  demo_btn.click(
260
- fn=lambda: ("My protein shake recipe ended up on the floor 😭 #gymfail", 15, 19, "Monday", "Fitness", 50000, "18-24", "Male"),
261
  inputs=None,
262
  outputs=[input_text, duration_slider, hour_slider, day_dropdown, category, followers, age, gender]
263
  ).then(
264
  fn=predict_and_optimize,
265
- inputs=[gr.State("My protein shake recipe ended up on the floor 😭 #gymfail"), gr.State(15), gr.State(19), gr.State("Monday"), gr.State("Fitness"), gr.State(50000), gr.State("18-24"), gr.State("Male")],
266
  outputs=[initial_views, similar_videos, improved_text, new_views, uplift]
267
  )
268
 
 
38
  except Exception as e:
39
  raise RuntimeError(f"Failed to load dataset from HF: {e}")
40
 
41
+ # 2. FIT ENCODERS (For Feature Consistency)
42
  print("πŸ”€ Fitting Label Encoders...")
43
  cat_cols = ['category', 'gender', 'day_of_week', 'age']
44
  for c in cat_cols:
 
76
  device = "mps" if torch.backends.mps.is_available() else "cpu"
77
  st_model = SentenceTransformer(embedding_model_name, device=device)
78
 
79
+ # 5. Generate Embeddings
80
  print("βš™οΈ Generating Embeddings for Knowledge Base (One-time setup)...")
81
  if 'embedding' not in knowledge_df.columns:
82
  embeddings = st_model.encode(knowledge_df['description'].fillna("").tolist(),
 
257
 
258
  # Demo Button Logic
259
  demo_btn.click(
260
+ fn=lambda: ("My protein shake ended up on the floor", 15, 19, "Monday", "Fitness", 50000, "18-24", "Male"),
261
  inputs=None,
262
  outputs=[input_text, duration_slider, hour_slider, day_dropdown, category, followers, age, gender]
263
  ).then(
264
  fn=predict_and_optimize,
265
+ inputs=[gr.State("My protein shake ended up on the floor"), gr.State(15), gr.State(19), gr.State("Monday"), gr.State("Fitness"), gr.State(50000), gr.State("18-24"), gr.State("Male")],
266
  outputs=[initial_views, similar_videos, improved_text, new_views, uplift]
267
  )
268