yoniif commited on
Commit
bb0926c
·
verified ·
1 Parent(s): d051c8c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -36
app.py CHANGED
@@ -42,57 +42,47 @@ def format_output(brand_input):
42
  html = ""
43
  for i, rec in enumerate(recs, 1):
44
  html += f"""
45
- <div class='card'>
46
- <h3>{i}. {rec['Name']} <span class='platform'>({rec['Platform']})</span></h3>
47
- <p><strong>Niche:</strong> {rec['Niche']}</p>
48
- <p><strong>Country:</strong> {rec['Country']}</p>
49
- <p><strong>Engagement Rate:</strong> {rec['ER']}</p>
50
- <p><strong>Followers:</strong> {rec['Followers']}</p>
51
- {f"<p><strong>Reach:</strong> {rec['Reach']}</p>" if rec['Reach'] else ""}
52
  </div>
53
  """
54
  return html
55
 
56
- # Custom CSS: light theme, professional readability
57
- custom_css = """
58
- body { background-color: #f5f5f5; color: #333333; font-family: 'Helvetica Neue', Arial, sans-serif; }
59
- .interface-title { color: #0a1f44 !important; font-size: 2rem !important; margin-bottom: 0.5rem; }
60
- .interface-description { color: #555555 !important; font-size: 1.1rem; margin-bottom: 1.5rem; }
61
- #input-box textarea { background-color: #ffffff !important; color: #333333; border: 2px solid #0a1f44; border-radius: 6px; padding: 0.8em; }
62
- #input-box label { color: #0a1f44 !important; font-weight: 600; margin-bottom: 0.3rem; }
63
- .gr-button.primary { background-color: #0a1f44 !important; color: #ffffff !important; border-radius: 6px !important; padding: 0.6em 1.2em !important; font-weight: 600; }
64
- .gr-button.primary:hover { background-color: #08305f !important; }
65
- .gr-button.secondary { background-color: #e0e0e0 !important; color: #0a1f44 !important; border-radius: 6px !important; padding: 0.6em 1.2em !important; margin-right: 1rem; }
66
- .gr-button.secondary:hover { background-color: #c9c9c9 !important; }
67
- #output-cards .card { background-color: #ffffff; color: #333333; border: 1px solid #dddddd; border-radius: 8px; padding: 1rem; margin-bottom: 1rem; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
68
- #output-cards h3 { margin-bottom: 0.5rem; color: #0a1f44; font-size: 1.25rem; }
69
- #output-cards .platform { font-size: 0.9rem; color: #666666; }
70
- .examples-container { margin-top: 1rem; }
71
- .examples-container .example { background-color: #ffffff; color: #333333; border: 1px solid #0a1f44; border-radius: 6px; padding: 0.5rem 1rem; margin: 0.3rem; display: inline-block; }
72
- """
73
-
74
  # Build the Gradio interface
75
- demo = gr.Interface(
76
  fn=format_output,
77
  inputs=gr.Textbox(
78
- label="Enhance Your Social Media Campaigns",
79
- placeholder="e.g. Targeted fitness brand outreach for Gen Z",
80
  lines=3,
81
- elem_id="input-box"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  ),
83
- outputs=gr.HTML(elem_id="output-cards"),
84
- title="InfluMatch: Targeted Influencer Discovery",
85
- description="Harness AI to identify and engage niche influencers to maximize your social media marketing ROI.",
86
  examples=[
87
  ["Sustainable fashion campaign targeting eco-conscious millennials"],
88
  ["Tech gadget launch aimed at early adopters in the US"],
89
  ["Healthy snack brand outreach for fitness enthusiasts"],
90
  ["Luxury travel experiences for affluent couples in Europe"]
91
  ],
92
- css=custom_css,
93
- theme="default",
94
- flagging_mode="never"
95
  )
96
 
97
  if __name__ == "__main__":
98
- demo.launch(share=True)
 
42
  html = ""
43
  for i, rec in enumerate(recs, 1):
44
  html += f"""
45
+ <div style='background:#ffffff; padding:1em; margin-bottom:1em; border-radius:8px; box-shadow:0 2px 6px rgba(0,0,0,0.1);'>
46
+ <h3 style='margin:0; color:#0a1f44;'>🎯 {i}. {rec['Name']} <span style='font-size:0.9em; color:#555;'>({rec['Platform']})</span></h3>
47
+ <p style='margin:0.5em 0;'><strong>Niche:</strong> {rec['Niche']}</p>
48
+ <p style='margin:0.5em 0;'><strong>Country:</strong> {rec['Country']}</p>
49
+ <p style='margin:0.5em 0;'><strong>Engagement:</strong> {rec['ER']}</p>
50
+ <p style='margin:0.5em 0;'><strong>Followers:</strong> {rec['Followers']}</p>
51
+ {f"<p style='margin:0.5em 0;'><strong>Reach:</strong> {rec['Reach']}</p>" if rec['Reach'] else ""}
52
  </div>
53
  """
54
  return html
55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  # Build the Gradio interface
57
+ iface = gr.Interface(
58
  fn=format_output,
59
  inputs=gr.Textbox(
 
 
60
  lines=3,
61
+ label="🗣️ Describe Your Campaign or Brand",
62
+ placeholder="e.g., Targeted fitness brand outreach for Gen Z"
63
+ ),
64
+ outputs=gr.HTML(
65
+ label="📈 Recommended Influencers"
66
+ ),
67
+ title="💡 InfluMatch: Targeted Influencer Discovery",
68
+ description=(
69
+ "Enhance your social media marketing by pinpointing the perfect influencers for your niche.\n\n"
70
+ "🛠️ AI-driven matching based on niche, audience, and engagement metrics — get top 3 influencer recommendations instantly."
71
+ ),
72
+ article=(
73
+ "**Project:** InfluMatch — AI-Powered Influencer Recommender\n"
74
+ "**Model:** sentence-transformers/all-MiniLM-L6-v2 for semantic embeddings\n"
75
+ "**Dataset:** Top 100 Social Media Influencers 2024 (Countrywise) from Kaggle"
76
  ),
 
 
 
77
  examples=[
78
  ["Sustainable fashion campaign targeting eco-conscious millennials"],
79
  ["Tech gadget launch aimed at early adopters in the US"],
80
  ["Healthy snack brand outreach for fitness enthusiasts"],
81
  ["Luxury travel experiences for affluent couples in Europe"]
82
  ],
83
+ theme="soft",
84
+ allow_flagging=False
 
85
  )
86
 
87
  if __name__ == "__main__":
88
+ iface.launch(share=True)