subhan971 commited on
Commit
8b9b1de
·
verified ·
1 Parent(s): df23a81

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -4,8 +4,7 @@ import mimetypes
4
  import cv2
5
  import uuid
6
  import streamlit as st
7
- from google import generativeai as genai
8
- # import pywhatkit
9
  import urllib.parse
10
 
11
  # Configure Gemini API
@@ -53,8 +52,7 @@ def process_image(image_path, model):
53
  response = model.generate_content(
54
  [
55
  {"mime_type": mime_type, "data": image_data},
56
- """complete analyze the given picture pay attention any detail of picture and tell which pakistani song is suitble according person in picture
57
- just give me the name of one hindi song according to peroson in pic and just give the name of song no other detail just name ."""
58
  ]
59
  )
60
  return response.text.strip()
@@ -95,7 +93,7 @@ if "image_path" in st.session_state and st.button("Suggest Hindi Song"):
95
  try:
96
  suggested_song = process_image(st.session_state.image_path, model)
97
  st.success(f"🎵 Suggested Hindi Song: {suggested_song}")
98
- search_query = urllib.parse.quote_plus(suggested_song + " song")
99
  youtube_link = f"https://www.youtube.com/results?search_query={search_query}"
100
  st.markdown(f"[🔗 Click to search on YouTube]({youtube_link})", unsafe_allow_html=True)
101
  except Exception as e:
 
4
  import cv2
5
  import uuid
6
  import streamlit as st
7
+ from google import generativeai as genai
 
8
  import urllib.parse
9
 
10
  # Configure Gemini API
 
52
  response = model.generate_content(
53
  [
54
  {"mime_type": mime_type, "data": image_data},
55
+ """Analyze the given picture thoroughly, focusing on every detail of the person's appearance, expression, clothing, background, and overall mood. Based on this analysis, choose one Hindi song that best suits the personality, vibe, or emotion of the person in the picture. Just give the name of one Hindi song—no explanation, no extra text."""
 
56
  ]
57
  )
58
  return response.text.strip()
 
93
  try:
94
  suggested_song = process_image(st.session_state.image_path, model)
95
  st.success(f"🎵 Suggested Hindi Song: {suggested_song}")
96
+ search_query = urllib.parse.quote_plus(suggested_song)
97
  youtube_link = f"https://www.youtube.com/results?search_query={search_query}"
98
  st.markdown(f"[🔗 Click to search on YouTube]({youtube_link})", unsafe_allow_html=True)
99
  except Exception as e: