Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,6 +18,7 @@ st.set_page_config(
|
|
| 18 |
)
|
| 19 |
|
| 20 |
PromptPrefix = 'Create a markdown outline and table with appropriate emojis for word game rules defining the method steps of play for topic of '
|
|
|
|
| 21 |
|
| 22 |
st.markdown('''### WordGameAI ๐โจ๐
|
| 23 |
- **Unlock the Power of Words with Mixable Word Game AI:** Transform your vocabulary with an AI that brings words to life.
|
|
@@ -193,39 +194,34 @@ roleplaying_glossary = {
|
|
| 193 |
|
| 194 |
}
|
| 195 |
|
| 196 |
-
|
| 197 |
def search_glossary(query):
|
| 198 |
for category, terms in roleplaying_glossary.items():
|
| 199 |
if query.lower() in (term.lower() for term in terms):
|
| 200 |
st.markdown(f"#### {category}")
|
| 201 |
st.write(f"- {query}")
|
| 202 |
-
|
| 203 |
-
query = PromptPrefix + query # Add prompt preface for method step task behavior
|
| 204 |
|
| 205 |
-
st.write('## ' + query)
|
| 206 |
-
|
| 207 |
all=""
|
|
|
|
|
|
|
|
|
|
| 208 |
st.write('## ๐ Running with GPT.') # -------------------------------------------------------------------------------------------------
|
| 209 |
-
response = chat_with_model(
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
filename = generate_filename(query + ' --- ' + response, "md")
|
| 213 |
create_file(filename, query, response, should_save)
|
| 214 |
|
| 215 |
-
#
|
| 216 |
-
#
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
|
|
|
| 220 |
|
| 221 |
-
all = '# Query: ' + query + '# Response: ' + response
|
| 222 |
filename_txt2 = generate_filename(query + ' --- ' + all, "md")
|
| 223 |
create_file(filename_txt2, query, all, should_save)
|
| 224 |
-
|
| 225 |
SpeechSynthesis(all)
|
| 226 |
return all
|
| 227 |
|
| 228 |
-
|
| 229 |
# Function to display the glossary in a structured format
|
| 230 |
def display_glossary(glossary, area):
|
| 231 |
if area in glossary:
|
|
|
|
| 18 |
)
|
| 19 |
|
| 20 |
PromptPrefix = 'Create a markdown outline and table with appropriate emojis for word game rules defining the method steps of play for topic of '
|
| 21 |
+
PromptPrefix2 = 'Create a streamlit python user interface full code listing and app with appropriate emojis for word game rules defining the method steps of play for topic of '
|
| 22 |
|
| 23 |
st.markdown('''### WordGameAI ๐โจ๐
|
| 24 |
- **Unlock the Power of Words with Mixable Word Game AI:** Transform your vocabulary with an AI that brings words to life.
|
|
|
|
| 194 |
|
| 195 |
}
|
| 196 |
|
|
|
|
| 197 |
def search_glossary(query):
|
| 198 |
for category, terms in roleplaying_glossary.items():
|
| 199 |
if query.lower() in (term.lower() for term in terms):
|
| 200 |
st.markdown(f"#### {category}")
|
| 201 |
st.write(f"- {query}")
|
|
|
|
|
|
|
| 202 |
|
|
|
|
|
|
|
| 203 |
all=""
|
| 204 |
+
|
| 205 |
+
query2 = PromptPrefix + query # Add prompt preface for method step task behavior
|
| 206 |
+
# st.write('## ' + query2)
|
| 207 |
st.write('## ๐ Running with GPT.') # -------------------------------------------------------------------------------------------------
|
| 208 |
+
response = chat_with_model(query2)
|
| 209 |
+
filename = generate_filename(query2 + ' --- ' + response, "md")
|
|
|
|
|
|
|
| 210 |
create_file(filename, query, response, should_save)
|
| 211 |
|
| 212 |
+
query3 = PromptPrefix2 + query # Add prompt preface for coding task behavior
|
| 213 |
+
# st.write('## ' + query3)
|
| 214 |
+
st.write('## ๐ Coding with GPT.') # -------------------------------------------------------------------------------------------------
|
| 215 |
+
response2 = chat_with_model(query3)
|
| 216 |
+
filename_txt = generate_filename(query + ' --- ' + response2, "py")
|
| 217 |
+
create_file(filename_txt, query, response2, should_save)
|
| 218 |
|
| 219 |
+
all = '# Query: ' + query + '# Response: ' + response + '# Response2: ' + response2
|
| 220 |
filename_txt2 = generate_filename(query + ' --- ' + all, "md")
|
| 221 |
create_file(filename_txt2, query, all, should_save)
|
|
|
|
| 222 |
SpeechSynthesis(all)
|
| 223 |
return all
|
| 224 |
|
|
|
|
| 225 |
# Function to display the glossary in a structured format
|
| 226 |
def display_glossary(glossary, area):
|
| 227 |
if area in glossary:
|