Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
# ββββββββββββββββββββββββββββββββ Imports ββββββββββββββββββββββββββββββββ
|
2 |
import os, json, re, logging, requests, markdown, time, io
|
3 |
from datetime import datetime
|
@@ -67,7 +69,7 @@ Follow these 8 steps exactly in order to write the blog post:
|
|
67 |
|
68 |
### 1. Start with a greeting and empathy
|
69 |
- Open with a friendly tone that draws the reader in
|
70 |
-
- Ask questions or present scenarios that resonate with the reader
|
71 |
|
72 |
### 2. Clearly present the problem
|
73 |
- Pinpoint the exact and realistic problem the reader is facing
|
@@ -88,7 +90,7 @@ Follow these 8 steps exactly in order to write the blog post:
|
|
88 |
|
89 |
### 6. Call to action (CTA)
|
90 |
- Encourage the reader to take specific actions immediately
|
91 |
-
- Use urgent language such as
|
92 |
|
93 |
### 7. Add constraints or warnings to increase authenticity
|
94 |
- Acknowledge that the solution might not work for everyone
|
@@ -117,7 +119,7 @@ Reader Connection Phase
|
|
117 |
1.3. Stimulate immediate interest in the topic
|
118 |
|
119 |
Problem Definition Phase
|
120 |
-
2.1. Define the reader
|
121 |
2.2. Analyze the urgency and impact of the problem
|
122 |
2.3. Build a consensus on why it needs to be solved
|
123 |
|
@@ -199,7 +201,7 @@ This blog should be SEO-optimized:
|
|
199 |
# Additional guidelines for each tone
|
200 |
tone_guides = {
|
201 |
"professional": "Use a professional, authoritative voice. Clearly explain any technical terms and present data or research to maintain a logical flow.",
|
202 |
-
"casual": "Use a relaxed, conversational style. Employ personal experiences, relatable examples, and a friendly voice (e.g., 'It
|
203 |
"humorous": "Use humor and witty expressions. Add funny analogies or jokes while preserving accuracy and usefulness.",
|
204 |
"storytelling": "Write as if telling a story, with emotional depth and narrative flow. Incorporate characters, settings, conflicts, and resolutions."
|
205 |
}
|
@@ -209,7 +211,7 @@ This blog should be SEO-optimized:
|
|
209 |
Guidelines for Using Search Results:
|
210 |
- Accurately incorporate key information from the search results into the blog
|
211 |
- Include recent data, statistics, and case studies from the search results
|
212 |
-
- When quoting, specify the source within the text (e.g.,
|
213 |
- At the end of the blog, add a "References" section and list major sources with links
|
214 |
- If there are conflicting pieces of information, present multiple perspectives
|
215 |
- Make sure to reflect the latest trends and data from the search results
|
@@ -222,12 +224,12 @@ Guidelines for Using Uploaded Files (Highest Priority):
|
|
222 |
- Carefully examine the data, statistics, or examples in the file and integrate them
|
223 |
- Directly quote and thoroughly explain any key figures or claims from the file
|
224 |
- Highlight the file content as a crucial aspect of the blog
|
225 |
-
- Mention the source clearly, e.g.,
|
226 |
- For CSV files, detail important stats or numerical data in the blog
|
227 |
- For PDF files, quote crucial segments or statements
|
228 |
- For text files, integrate relevant content effectively
|
229 |
- Even if the file content seems tangential, do your best to connect it to the blog topic
|
230 |
-
- Keep consistency throughout and ensure the file
|
231 |
"""
|
232 |
|
233 |
# Choose base prompt
|
@@ -711,7 +713,7 @@ def process_input(prompt: str, uploaded_files):
|
|
711 |
# Add user's message if it doesn't already exist
|
712 |
if not any(m["role"] == "user" and m["content"] == prompt for m in st.session_state.messages):
|
713 |
st.session_state.messages.append({"role": "user", "content": prompt})
|
714 |
-
|
715 |
with st.chat_message("user"):
|
716 |
st.markdown(prompt)
|
717 |
|
@@ -846,4 +848,4 @@ def main():
|
|
846 |
ginigen_app()
|
847 |
|
848 |
if __name__ == "__main__":
|
849 |
-
main()
|
|
|
1 |
+
# CHATGPT APIλ‘ λ³κ²½
|
2 |
+
|
3 |
# ββββββββββββββββββββββββββββββββ Imports ββββββββββββββββββββββββββββββββ
|
4 |
import os, json, re, logging, requests, markdown, time, io
|
5 |
from datetime import datetime
|
|
|
69 |
|
70 |
### 1. Start with a greeting and empathy
|
71 |
- Open with a friendly tone that draws the reader in
|
72 |
+
- Ask questions or present scenarios that resonate with the reader's real-life concerns
|
73 |
|
74 |
### 2. Clearly present the problem
|
75 |
- Pinpoint the exact and realistic problem the reader is facing
|
|
|
90 |
|
91 |
### 6. Call to action (CTA)
|
92 |
- Encourage the reader to take specific actions immediately
|
93 |
+
- Use urgent language such as "right now," "from today," or "immediately" to drive action
|
94 |
|
95 |
### 7. Add constraints or warnings to increase authenticity
|
96 |
- Acknowledge that the solution might not work for everyone
|
|
|
119 |
1.3. Stimulate immediate interest in the topic
|
120 |
|
121 |
Problem Definition Phase
|
122 |
+
2.1. Define the reader's pain points in detail
|
123 |
2.2. Analyze the urgency and impact of the problem
|
124 |
2.3. Build a consensus on why it needs to be solved
|
125 |
|
|
|
201 |
# Additional guidelines for each tone
|
202 |
tone_guides = {
|
203 |
"professional": "Use a professional, authoritative voice. Clearly explain any technical terms and present data or research to maintain a logical flow.",
|
204 |
+
"casual": "Use a relaxed, conversational style. Employ personal experiences, relatable examples, and a friendly voice (e.g., 'It's super useful!').",
|
205 |
"humorous": "Use humor and witty expressions. Add funny analogies or jokes while preserving accuracy and usefulness.",
|
206 |
"storytelling": "Write as if telling a story, with emotional depth and narrative flow. Incorporate characters, settings, conflicts, and resolutions."
|
207 |
}
|
|
|
211 |
Guidelines for Using Search Results:
|
212 |
- Accurately incorporate key information from the search results into the blog
|
213 |
- Include recent data, statistics, and case studies from the search results
|
214 |
+
- When quoting, specify the source within the text (e.g., "According to XYZ website...")
|
215 |
- At the end of the blog, add a "References" section and list major sources with links
|
216 |
- If there are conflicting pieces of information, present multiple perspectives
|
217 |
- Make sure to reflect the latest trends and data from the search results
|
|
|
224 |
- Carefully examine the data, statistics, or examples in the file and integrate them
|
225 |
- Directly quote and thoroughly explain any key figures or claims from the file
|
226 |
- Highlight the file content as a crucial aspect of the blog
|
227 |
+
- Mention the source clearly, e.g., "According to the uploaded data..."
|
228 |
- For CSV files, detail important stats or numerical data in the blog
|
229 |
- For PDF files, quote crucial segments or statements
|
230 |
- For text files, integrate relevant content effectively
|
231 |
- Even if the file content seems tangential, do your best to connect it to the blog topic
|
232 |
+
- Keep consistency throughout and ensure the file's data is appropriately reflected
|
233 |
"""
|
234 |
|
235 |
# Choose base prompt
|
|
|
713 |
# Add user's message if it doesn't already exist
|
714 |
if not any(m["role"] == "user" and m["content"] == prompt for m in st.session_state.messages):
|
715 |
st.session_state.messages.append({"role": "user", "content": prompt})
|
716 |
+
|
717 |
with st.chat_message("user"):
|
718 |
st.markdown(prompt)
|
719 |
|
|
|
848 |
ginigen_app()
|
849 |
|
850 |
if __name__ == "__main__":
|
851 |
+
main()
|