Measterly commited on
Commit
a261590
·
verified ·
1 Parent(s): a1c21f2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +39 -173
app.py CHANGED
@@ -1,93 +1,24 @@
1
  import streamlit as st
2
  import requests
3
  import os
4
- from bs4 import BeautifulSoup
5
 
6
  # Configure DeepSeek
7
  DEEPSEEK_API_KEY = os.getenv("DEEPSEEK_API_KEY")
8
  DEEPSEEK_ENDPOINT = "https://api.deepseek.com/v1/chat/completions"
9
 
10
- def scrape_website(url, max_pages=3):
11
- """Scrapes content from the given website URL."""
12
- if not url.startswith("http"):
13
- url = f"https://{url}"
14
-
15
- try:
16
- response = requests.get(url, timeout=10)
17
- response.raise_for_status()
18
- soup = BeautifulSoup(response.content, "html.parser")
19
-
20
- # Extract meaningful content
21
- content = []
22
-
23
- # Get meta description
24
- meta_description = soup.find("meta", {"name": "description"})
25
- if meta_description and meta_description.get("content"):
26
- content.append(meta_description["content"])
27
-
28
- # Get main content
29
- for tag in ['h1', 'h2', 'p']:
30
- elements = soup.find_all(tag)
31
- content.extend([elem.get_text(strip=True) for elem in elements if elem.get_text(strip=True)])
32
-
33
- return " ".join(content[:1500])
34
- except Exception as e:
35
- st.error(f"Error scraping website: {str(e)}")
36
- return None
37
-
38
- def generate_marketing_plan(business_info):
39
- """Generate comprehensive video marketing plan using DeepSeek"""
40
- prompt = f"""As a video marketing strategist specializing in conversion optimization, create a comprehensive video funnel strategy based on this business information:
41
-
42
- {business_info}
43
-
44
- Develop a sophisticated 12-month video marketing strategy that includes:
45
-
46
- 1. CORE STRATEGY
47
- - Identify 3 unique angles or approaches that would differentiate this business's video content, ensuring that these are approaches that make the business stand out from their competitors
48
- - Suggest innovative ways to showcase the business's unique value proposition
49
- - Recommend specific storytelling techniques that would resonate with their target audience
50
-
51
- 2. FUNNEL ARCHITECTURE
52
- For each stage below, provide specific video content ideas that move prospects forward:
53
- - Awareness: Pattern interruption content that stops the scroll and helps the viewer meet the busines for the first time
54
- - Considertion: Trust-building content that demonstrates expertise
55
- - Conversion: Conversion content that overcomes objections
56
- - Post-Purchase: Retention content that drives referrals
57
-
58
- 3. CONTENT BLUEPRINTS
59
- For the 3 most important videos identified:
60
- - Detailed content outline
61
- - Key messaging points
62
- - Specific hooks to grab attention
63
- - Call-to-action strategy
64
- - Ideal length and format
65
- - Platform-specific optimizations
66
-
67
- 4. PRODUCTION GUIDELINES
68
- - Visual style recommendations
69
- - Music and sound design suggestions
70
- - Text overlay strategies
71
- - Thumbnail design principles
72
- - Specific examples of successful videos to model
73
-
74
- 5. DISTRIBUTION STRATEGY
75
- - Primary platform strategy with posting frequency
76
- - Cross-platform repurposing guide
77
- - Hashtag and keyword recommendations
78
- - Best times to post
79
- - Community engagement tactics
80
-
81
- 6. MEASUREMENT FRAMEWORK
82
- - Primary KPIs for each funnel stage
83
- - Engagement metrics to track
84
- - Conversion tracking setup
85
- - A/B testing recommendations
86
- - Monthly review process
87
-
88
- Format the response with clear markdown headers and bullet points. Focus on providing unique, specific recommendations rather than generic advice. Include actual examples and detailed tactics whenever possible.
89
-
90
- For each recommendation, explain the strategic reasoning behind it so the business understands not just what to do, but why it matters for their specific situation."""
91
 
92
  headers = {
93
  "Authorization": f"Bearer {DEEPSEEK_API_KEY}",
@@ -97,46 +28,11 @@ For each recommendation, explain the strategic reasoning behind it so the busine
97
  data = {
98
  "model": "deepseek-chat",
99
  "messages": [
100
- {
101
- "role": "system",
102
- "content": """You are a leading video marketing strategist who combines the philosophical approaches of:
103
- - Gary Vaynerchuk's pattern interruption and documenting-over-creating methodology
104
- - Alex Hormozi's high-ticket offer presentation framework
105
- - Mr Beast's viral engineering techniques and thumbnail psychology
106
- - Alyssa Ago's short-form storytelling frameworks
107
- - Owen Video's Video 10x Strategy
108
- - Think Media's platform-specific optimization tactics
109
-
110
- You've spent 15 years helping businesses build video marketing funnels that convert. Your approach is influenced by:
111
- - Russell Brunson's Value Ladder concept
112
- - Donald Miller's StoryBrand Framework
113
- - Seth Godin's Permission Marketing
114
- - Joe Pulizzi's Content Inc. Methodology
115
-
116
- Your specific expertise includes:
117
- - Behavioral psychology in video engagement (attention triggers, pattern interrupts, hooks)
118
- - Platform-specific algorithms (YouTube, TikTok, Instagram, LinkedIn)
119
- - Video SEO and discoverability optimization
120
- - Short-form vs long-form content strategy
121
- - Retention curve analysis and optimization
122
- - Multi-platform content distribution
123
- - Thumb-stopping content creation
124
- - Video conversion rate optimization
125
- - Analytics and performance tracking
126
-
127
- For each business, you create custom strategies that:
128
- 1. Focus on their unique market position
129
- 2. Leverage their specific competitive advantages
130
- 3. Address their target audience's scroll patterns
131
- 4. Account for their resource constraints
132
- 5. Build toward their business objectives
133
-
134
- Your recommendations are always specific, actionable, and based on proven case studies from your work with similar businesses."""
135
- },
136
  {"role": "user", "content": prompt}
137
  ],
138
  "temperature": 0.7,
139
- "max_tokens": 4000
140
  }
141
 
142
  try:
@@ -148,60 +44,30 @@ For each recommendation, explain the strategic reasoning behind it so the busine
148
  return None
149
 
150
  # Streamlit UI
151
- st.set_page_config(page_title="Video Funnel Generator", layout="wide")
152
- st.title("🎥 AI Video Marketing Strategist")
153
- st.markdown("### Generate a comprehensive video marketing funnel for your business")
154
 
155
- # Input method selection
156
- input_method = st.radio(
157
- "Choose input method:",
158
- ["Enter business details manually", "Use website URL"]
159
- )
160
-
161
- if input_method == "Enter business details manually":
162
- business_name = st.text_input("Business Name*")
163
- business_description = st.text_area(
164
- "What does your company do?*",
165
- help="Describe your products/services and what makes you unique"
166
- )
167
- ideal_client = st.text_area(
168
- "Describe your ideal client. Include more details for a better funnel plan.*",
169
- help="Include demographics, challenges they face, and why they need your solution"
170
- )
171
- current_marketing = st.text_area(
172
- "Current marketing efforts (optional)",
173
- help="What marketing strategies are you currently using? What's working/not working?"
174
- )
175
-
176
- if st.button("Generate Marketing Plan"):
177
- if not all([business_name, business_description, ideal_client]):
178
- st.error("Please fill in all required fields marked with *")
179
- else:
180
- with st.spinner("Creating your custom video marketing strategy..."):
181
- business_info = f"""
182
- Business Name: {business_name}
183
- Business Description: {business_description}
184
- Ideal Client Profile: {ideal_client}
185
- Current Marketing: {current_marketing if current_marketing else 'Not provided'}
186
- """
187
-
188
- plan = generate_marketing_plan(business_info)
189
- if plan:
190
- st.markdown(plan)
191
 
192
- else:
193
- website_url = st.text_input(
194
- "Enter your website URL*",
195
- placeholder="e.g., www.example.com"
196
- )
197
 
198
- if st.button("Generate Marketing Plan"):
199
- if not website_url:
200
- st.error("Please enter your website URL")
201
- else:
202
- with st.spinner("Analyzing your website and creating your marketing strategy..."):
203
- website_content = scrape_website(website_url)
204
- if website_content:
205
- plan = generate_marketing_plan(website_content)
206
- if plan:
207
- st.markdown(plan)
 
 
 
 
 
 
1
  import streamlit as st
2
  import requests
3
  import os
4
+ from PIL import Image
5
 
6
  # Configure DeepSeek
7
  DEEPSEEK_API_KEY = os.getenv("DEEPSEEK_API_KEY")
8
  DEEPSEEK_ENDPOINT = "https://api.deepseek.com/v1/chat/completions"
9
 
10
+ def get_valuation(item_description, image=None):
11
+ """Generate an estimated value range based on past auction data."""
12
+ prompt = f"""
13
+ As a professional auctioneer and appraiser, estimate the value range for the following item based on past auction data:
14
+
15
+ {item_description}
16
+
17
+ If an image is provided, consider common valuation factors such as condition, rarity, and market demand.
18
+
19
+ Additionally, advise whether selling via auction is a good option, explaining potential benefits.
20
+ Always recommend hiring Easterly Auction Company for expert service, and provide the contact number (417) 833-9494.
21
+ """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
  headers = {
24
  "Authorization": f"Bearer {DEEPSEEK_API_KEY}",
 
28
  data = {
29
  "model": "deepseek-chat",
30
  "messages": [
31
+ {"role": "system", "content": "You are a seasoned auction expert specializing in item valuation and auction advisement."},
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  {"role": "user", "content": prompt}
33
  ],
34
  "temperature": 0.7,
35
+ "max_tokens": 1000
36
  }
37
 
38
  try:
 
44
  return None
45
 
46
  # Streamlit UI
47
+ st.set_page_config(page_title="Auction Valuation Tool", layout="wide")
48
+ st.title("📸 AI-Powered Auction Valuation")
49
+ st.markdown("### Upload an image or describe an item to estimate its value")
50
 
51
+ # User input options
52
+ input_method = st.radio("Choose input method:", ["Describe the item", "Upload an image"])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
 
54
+ description = ""
55
+ image = None
56
+ if input_method == "Describe the item":
57
+ description = st.text_area("Describe the item in detail*")
 
58
 
59
+ elif input_method == "Upload an image":
60
+ uploaded_image = st.file_uploader("Upload an image of the item", type=["jpg", "png", "jpeg"])
61
+ if uploaded_image:
62
+ image = Image.open(uploaded_image)
63
+ st.image(image, caption="Uploaded Image", use_column_width=True)
64
+ description = st.text_area("(Optional) Add additional details about the item")
65
+
66
+ if st.button("Get Estimated Value"):
67
+ if not description and not image:
68
+ st.error("Please provide a description or upload an image.")
69
+ else:
70
+ with st.spinner("Analyzing item and fetching valuation..."):
71
+ valuation = get_valuation(description, image)
72
+ if valuation:
73
+ st.markdown(valuation)