Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -49,6 +49,7 @@ PromptPrefix3 = 'Create a HTML5 aframe and javascript app. Show full code listi
|
|
49 |
|
50 |
# Title and Help/About
|
51 |
st.markdown('''### πβ¨π GraphicNovelAI ''')
|
|
|
52 |
with st.expander("Help / About π", expanded=False):
|
53 |
st.markdown('''
|
54 |
- π **Unlock Plots:** Elevate your vocabulary with AI. Turns plots into thrilling experiences.
|
@@ -56,7 +57,6 @@ with st.expander("Help / About π", expanded=False):
|
|
56 |
- π§ββοΈ **Experience:** Become a graphic novel plot wizard, boost your language skills.
|
57 |
- π **Query Use:** Input `?q=Palindrome` or `?query=Anagram` in URL for new challenges.
|
58 |
''')
|
59 |
-
|
60 |
# Aaron's Intelligent Style Guide for AI Graphic Novel Writers
|
61 |
parts_of_speech = [
|
62 |
{"type": "Noun", "description": "Person, place, thing, or idea", "example": "Hero, city, spaceship, justice"},
|
@@ -70,7 +70,6 @@ with st.expander("Help / About π", expanded=False):
|
|
70 |
{"type": "Theme", "description": "Underlying message or main idea", "example": "The quest for identity, the battle between good and evil"},
|
71 |
{"type": "Motif", "description": "Recurring element that has symbolic significance", "example": "Repeated imagery of masks to signify identity"}
|
72 |
]
|
73 |
-
|
74 |
language_structures = [
|
75 |
{"type": "Glossary", "description": "Vocabulary Reference: List of terms and their definitions", "example": "Villain: The antagonist of the story"},
|
76 |
{"type": "Dialogue", "description": "Conversational Text: Characters' spoken words", "example": "We must act now! exclaimed the hero"},
|
@@ -83,11 +82,7 @@ with st.expander("Help / About π", expanded=False):
|
|
83 |
{"type": "Plot Twists", "description": "Unexpected changes in the story direction", "example": "The hero discovers their enemy is their sibling"},
|
84 |
{"type": "Backstory", "description": "Historical or background context of characters or setting", "example": "Once a celebrated hero, now a forgotten legend"}
|
85 |
]
|
86 |
-
|
87 |
-
import streamlit as st
|
88 |
-
|
89 |
# Assuming 'parts_of_speech' and 'language_structures' are defined as above
|
90 |
-
|
91 |
def display_elements(elements, title):
|
92 |
st.markdown(f"## {title}")
|
93 |
for element in elements:
|
@@ -97,14 +92,12 @@ with st.expander("Help / About π", expanded=False):
|
|
97 |
- **Example**: {element['example']}
|
98 |
""")
|
99 |
|
|
|
100 |
st.title("Graphic Novel Creation Toolkit")
|
101 |
-
|
102 |
display_elements(parts_of_speech, "Parts of Speech for Dramatic Situations")
|
103 |
display_elements(language_structures, "Language Structures for Dramatic Situations")
|
104 |
|
105 |
|
106 |
-
|
107 |
-
|
108 |
# MoE Context Glossary
|
109 |
roleplaying_glossary = {
|
110 |
"π¨βπ©βπ§βπ¦ Top Graphic Novel Plot Themes": {
|
@@ -204,7 +197,7 @@ def SpeechSynthesis(result):
|
|
204 |
|
205 |
|
206 |
|
207 |
-
# 9.
|
208 |
@st.cache_resource
|
209 |
def get_table_download_link(file_path):
|
210 |
with open(file_path, 'r') as file:
|
@@ -284,37 +277,24 @@ def FileSidebar():
|
|
284 |
buttonlabel = 'πRun'
|
285 |
if st.button(key='RunWithLlamaandGPT', label = buttonlabel):
|
286 |
user_prompt = file_contents
|
287 |
-
|
288 |
-
# gpt
|
289 |
try:
|
290 |
-
|
291 |
-
response2 = chat_with_model(user_prompt, file_contents, model_choice)
|
292 |
-
filename2 = generate_filename(file_contents, choice)
|
293 |
-
create_file(filename2, user_prompt, response, should_save)
|
294 |
-
all=response2
|
295 |
except:
|
296 |
st.markdown('GPT is sleeping. Restart ETA 30 seconds.')
|
297 |
-
|
298 |
-
SpeechSynthesis(all)
|
299 |
|
300 |
|
301 |
if next_action=='search':
|
302 |
file_content_area = st.text_area("File Contents:", file_contents, height=500)
|
303 |
-
#st.write('πRunning..')
|
304 |
-
|
305 |
user_prompt = file_contents
|
306 |
-
|
307 |
-
# gpt
|
308 |
try:
|
309 |
-
|
310 |
-
response2 = chat_with_model(user_prompt, file_contents, model_choice)
|
311 |
-
filename2 = generate_filename(file_contents, choice)
|
312 |
-
create_file(filename2, user_prompt, response, should_save)
|
313 |
-
all=response2
|
314 |
except:
|
315 |
st.markdown('GPT is sleeping. Restart ETA 30 seconds.')
|
316 |
|
317 |
-
|
|
|
|
|
318 |
# ----------------------------------------------------- File Sidebar for Jump Gates ------------------------------------------
|
319 |
|
320 |
|
|
|
49 |
|
50 |
# Title and Help/About
|
51 |
st.markdown('''### πβ¨π GraphicNovelAI ''')
|
52 |
+
|
53 |
with st.expander("Help / About π", expanded=False):
|
54 |
st.markdown('''
|
55 |
- π **Unlock Plots:** Elevate your vocabulary with AI. Turns plots into thrilling experiences.
|
|
|
57 |
- π§ββοΈ **Experience:** Become a graphic novel plot wizard, boost your language skills.
|
58 |
- π **Query Use:** Input `?q=Palindrome` or `?query=Anagram` in URL for new challenges.
|
59 |
''')
|
|
|
60 |
# Aaron's Intelligent Style Guide for AI Graphic Novel Writers
|
61 |
parts_of_speech = [
|
62 |
{"type": "Noun", "description": "Person, place, thing, or idea", "example": "Hero, city, spaceship, justice"},
|
|
|
70 |
{"type": "Theme", "description": "Underlying message or main idea", "example": "The quest for identity, the battle between good and evil"},
|
71 |
{"type": "Motif", "description": "Recurring element that has symbolic significance", "example": "Repeated imagery of masks to signify identity"}
|
72 |
]
|
|
|
73 |
language_structures = [
|
74 |
{"type": "Glossary", "description": "Vocabulary Reference: List of terms and their definitions", "example": "Villain: The antagonist of the story"},
|
75 |
{"type": "Dialogue", "description": "Conversational Text: Characters' spoken words", "example": "We must act now! exclaimed the hero"},
|
|
|
82 |
{"type": "Plot Twists", "description": "Unexpected changes in the story direction", "example": "The hero discovers their enemy is their sibling"},
|
83 |
{"type": "Backstory", "description": "Historical or background context of characters or setting", "example": "Once a celebrated hero, now a forgotten legend"}
|
84 |
]
|
|
|
|
|
|
|
85 |
# Assuming 'parts_of_speech' and 'language_structures' are defined as above
|
|
|
86 |
def display_elements(elements, title):
|
87 |
st.markdown(f"## {title}")
|
88 |
for element in elements:
|
|
|
92 |
- **Example**: {element['example']}
|
93 |
""")
|
94 |
|
95 |
+
# process sets:
|
96 |
st.title("Graphic Novel Creation Toolkit")
|
|
|
97 |
display_elements(parts_of_speech, "Parts of Speech for Dramatic Situations")
|
98 |
display_elements(language_structures, "Language Structures for Dramatic Situations")
|
99 |
|
100 |
|
|
|
|
|
101 |
# MoE Context Glossary
|
102 |
roleplaying_glossary = {
|
103 |
"π¨βπ©βπ§βπ¦ Top Graphic Novel Plot Themes": {
|
|
|
197 |
|
198 |
|
199 |
|
200 |
+
# 9. Chat History File Sidebar
|
201 |
@st.cache_resource
|
202 |
def get_table_download_link(file_path):
|
203 |
with open(file_path, 'r') as file:
|
|
|
277 |
buttonlabel = 'πRun'
|
278 |
if st.button(key='RunWithLlamaandGPT', label = buttonlabel):
|
279 |
user_prompt = file_contents
|
|
|
|
|
280 |
try:
|
281 |
+
search_glossary(file_contents)
|
|
|
|
|
|
|
|
|
282 |
except:
|
283 |
st.markdown('GPT is sleeping. Restart ETA 30 seconds.')
|
284 |
+
#SpeechSynthesis(all)
|
|
|
285 |
|
286 |
|
287 |
if next_action=='search':
|
288 |
file_content_area = st.text_area("File Contents:", file_contents, height=500)
|
|
|
|
|
289 |
user_prompt = file_contents
|
|
|
|
|
290 |
try:
|
291 |
+
search_glossary(file_contents)
|
|
|
|
|
|
|
|
|
292 |
except:
|
293 |
st.markdown('GPT is sleeping. Restart ETA 30 seconds.')
|
294 |
|
295 |
+
except:
|
296 |
+
st.markdown('GPT is sleeping. Restart ETA 30 seconds.')
|
297 |
+
#SpeechSynthesis(all)
|
298 |
# ----------------------------------------------------- File Sidebar for Jump Gates ------------------------------------------
|
299 |
|
300 |
|