Spaces:
Sleeping
Sleeping
Update influencer_ui.py
Browse files- influencer_ui.py +10 -2
influencer_ui.py
CHANGED
|
@@ -35,10 +35,18 @@ def show_influencer_search_page():
|
|
| 35 |
data = {"search_query": search_query}
|
| 36 |
resp = requests.post(insta_rag_url, json=data)
|
| 37 |
response_dict = json.loads(resp.text)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
influencers_data = {response_dict.get('handle', "No Name"): {"name": response_dict.get('name', 'No Name'),
|
| 39 |
-
"image":
|
| 40 |
"details": response_dict.get('bio', '')}}
|
| 41 |
-
|
| 42 |
# Display influencer images as clickable buttons
|
| 43 |
for influencer_id, influencer_info in influencers_data.items():
|
| 44 |
col1, col2 = st.columns([1, 3])
|
|
|
|
| 35 |
data = {"search_query": search_query}
|
| 36 |
resp = requests.post(insta_rag_url, json=data)
|
| 37 |
response_dict = json.loads(resp.text)
|
| 38 |
+
|
| 39 |
+
# Download images
|
| 40 |
+
profile_img_url = response_dict.get('profile_image_url', profile_default_image_url)
|
| 41 |
+
img_response = requests.get(profile_img_url)
|
| 42 |
+
if img_response.status_code == 200:
|
| 43 |
+
image_url = f"downloaded_image_{response_dict.get('handle', "NoName")}.jpg"
|
| 44 |
+
with open(image_url, "wb") as file:
|
| 45 |
+
file.write(response.content)
|
| 46 |
influencers_data = {response_dict.get('handle', "No Name"): {"name": response_dict.get('name', 'No Name'),
|
| 47 |
+
"image": image_url,
|
| 48 |
"details": response_dict.get('bio', '')}}
|
| 49 |
+
|
| 50 |
# Display influencer images as clickable buttons
|
| 51 |
for influencer_id, influencer_info in influencers_data.items():
|
| 52 |
col1, col2 = st.columns([1, 3])
|