Update app.py
Browse files
app.py
CHANGED
@@ -530,77 +530,11 @@ def search_glossary(query): # ๐Run------------------------------------------
|
|
530 |
st.write(f"- {query}")
|
531 |
all=""
|
532 |
|
533 |
-
|
534 |
-
WordGameRules="""Generate 10 high-information words related to word game rules, used in context with emojis:
|
535 |
-
1. ๐ Rules: The official guidelines that govern the gameplay and objectives of a word game.
|
536 |
-
2. โฐ Time Limit: A constraint on the duration allowed for players to complete their turns or the entire game.
|
537 |
-
3. ๐ฒ Dice: Used in some word games to randomly determine letter selection or point values.
|
538 |
-
4. ๐ Dictionary: A reference book used to validate the legitimacy of words formed by players.
|
539 |
-
5. ๐ Alphabet: The set of letters used to construct words in the game, often with varying point values.
|
540 |
-
6. ๐ Turn: The opportunity for each player to form words or perform actions as per the game rules.
|
541 |
-
7. ๐งฉ Board: The playing surface on which letter tiles are placed to form words in certain word games.
|
542 |
-
8. ๐ Challenge: An action that allows players to contest the validity of words formed by their opponents.
|
543 |
-
9. ๐ฐ Score: Points earned by players for forming valid words, often based on letter values and word length.
|
544 |
-
10. โ Pass: An option for players to skip their turn if unable to form a word, sometimes with penalties."""
|
545 |
-
WordGamePython="""Generate 10 high-information words related to word game programming in Python, used in context with emojis:
|
546 |
-
1. ๐ Python: A high-level programming language known for its simplicity and readability.
|
547 |
-
2. ๐ String: A data type used to represent text, essential for handling words in a word game.
|
548 |
-
3. ๐ฒ Random: A Python module that generates random numbers, useful for letter selection or AI opponents.
|
549 |
-
4. ๐ Input: A function that allows players to enter their words or actions through the command line.
|
550 |
-
5. ๐ List: A data structure that stores multiple elements, handy for managing game components like letters or words.
|
551 |
-
6. ๐ Validation: The process of checking if a word entered by a player is valid according to the game rules.
|
552 |
-
7. ๐ Loop: A programming construct that allows repeated execution of code, useful for turn-based gameplay.
|
553 |
-
8. ๐จ Pygame: A popular Python library for creating games with graphics and sound.
|
554 |
-
9. ๐พ File I/O: Reading from and writing to files, useful for storing game data like high scores or word lists.
|
555 |
-
10. ๐ค AI: Implementing artificial intelligence techniques to create computer-controlled opponents in word games."""
|
556 |
-
|
557 |
-
|
558 |
-
WordGamePython2="""1. ๐จ Streamlit: A Python library for building interactive web apps, perfect for creating word games.
|
559 |
-
Example: st.title("Welcome to the Word Guessing Game! ๐ฎ")
|
560 |
-
|
561 |
-
2. ๐๏ธ JSON: A lightweight data interchange format, useful for storing and loading game data.
|
562 |
-
Example: game_data = json.loads(st.secrets["game_data"])
|
563 |
-
|
564 |
-
3. ๐ฒ Random: A Python module for generating random numbers, handy for selecting random words or letters.
|
565 |
-
Example: random_word = random.choice(word_list)
|
566 |
-
|
567 |
-
4. ๐ Time: A Python module for handling time-related tasks, such as measuring game duration or implementing timers.
|
568 |
-
Example: start_time = time.time()
|
569 |
-
|
570 |
-
5. ๐ Regex: Short for Regular Expressions, a powerful tool for pattern matching and text manipulation.
|
571 |
-
Example: if re.match(r"^[a-zA-Z]+$", user_input):
|
572 |
-
|
573 |
-
6. ๐ Requests: A Python library for making HTTP requests, useful for fetching word lists or definitions from online APIs.
|
574 |
-
Example: response = requests.get("https://api.wordnik.com/v4/words.json/randomWord")
|
575 |
-
|
576 |
-
7. ๐ผ๏ธ PIL (Python Imaging Library): A library for opening, manipulating, and saving images, great for adding visual elements to your word game.
|
577 |
-
Example: image = Image.open("background.jpg")
|
578 |
-
|
579 |
-
8. ๐ URLLib: A Python module for handling URLs, useful for encoding and decoding special characters in word-related URLs.
|
580 |
-
Example: encoded_word = quote(user_input)
|
581 |
-
|
582 |
-
9. ๐พ IO (Input/Output): A Python module for handling input and output operations, such as reading from and writing to files or in-memory buffers.
|
583 |
-
Example: word_list = BytesIO(requests.get("https://example.com/words.txt").content)
|
584 |
-
|
585 |
-
10. ๐งฉ Collections: A Python module providing useful data structures, such as deque for efficient list manipulation.
|
586 |
-
Example: letter_queue = deque(random.sample(string.ascii_uppercase, 10))"""
|
587 |
-
|
588 |
-
|
589 |
-
WordGameJavascript="""Generate 10 high-information words related to word game programming in Javascript, used in context with emojis:
|
590 |
-
1. ๐ Javascript: A versatile programming language commonly used for web-based games and interactivity.
|
591 |
-
2. ๐ท๏ธ HTML: The markup language used to structure the content of web pages, including game elements.
|
592 |
-
3. ๐จ CSS: A stylesheet language used to describe the presentation and layout of HTML elements in a game.
|
593 |
-
4. ๐ String: A primitive data type in Javascript used to represent textual data, crucial for word games.
|
594 |
-
5. ๐ฒ Math.random(): A built-in Javascript function that generates random numbers, handy for letter selection or AI moves.
|
595 |
-
6. ๐ prompt(): A function that displays a dialog box prompting the player to enter a word or make a choice.
|
596 |
-
7. ๐ RegExp: Regular expressions in Javascript, useful for pattern matching and validating player input.
|
597 |
-
8. ๐ฑ๏ธ addEventListener(): A method used to attach event handlers to elements, enabling interactivity in the game.
|
598 |
-
9. ๐พ localStorage: A web storage object that allows data to be stored in the browser, useful for saving game progress.
|
599 |
-
10. ๐ค AI: Implementing artificial intelligence algorithms in Javascript to create computer-controlled opponents."""
|
600 |
-
|
601 |
# ๐Run 1 - plain query
|
602 |
-
response = chat_with_model(query)
|
603 |
-
|
|
|
|
|
604 |
st.write('๐Run 1 is Complete.')
|
605 |
|
606 |
# ArXiv searcher ~-<>-~
|
@@ -620,63 +554,27 @@ Example: letter_queue = deque(random.sample(string.ascii_uppercase, 10))"""
|
|
620 |
# ๐Run PaperSummarizer
|
621 |
PaperSummarizer = ' Create a diagram graphical representation of this: Summarize this paper set with short emoji outlines and preserve links, shortening it significantly. Create emoji filled short summaries per paper structured as markdown tables and outlines and show full markdown code listing. '
|
622 |
result = str(result).replace('\n', ' ').replace('|', ' ')
|
623 |
-
|
624 |
all = query + ' ' + response
|
625 |
st.write('๐Run 3 - Paper Summarizer is Complete.')
|
626 |
|
627 |
# ๐Run AppSpecifier
|
628 |
AppSpecifier = ' Design and write a creative superpower creating specification for a genius coder which has the scientific methods of steps and functions defined in a multiple markdown topic table and outline ensemble which serves as a thesis and comprehensive plan to build.'
|
629 |
result = str(result).replace('\n', ' ').replace('|', ' ')
|
630 |
-
|
631 |
st.write('๐Run 4 - AppSpecifier is Complete.')
|
632 |
|
633 |
# ๐Run PythonAppCoder
|
634 |
PythonAppCoder = ' Create a streamlit python app implementing the following list of features using appropriate libraries and function design using streamlit. Show full code listing as output with no commentary. '
|
635 |
result = str(result).replace('\n', ' ').replace('|', ' ')
|
636 |
-
|
637 |
st.write('๐Run Python AppCoder is Complete.')
|
638 |
|
639 |
# experimental 45 - - - - - - - - - - - - -<><><><><>
|
640 |
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
specquery = specquery + 'For each one of the Game Features of the specification write three short fun game rules with a plan and description on how to play. Write each like a specification and a story and a game blending fun and humorous ideas which allow a player to get better at all modalities of language.'
|
645 |
-
specquery = specquery + 'Here is the list of word game rules you will expand on how with plan and specification. Use markdown code, tables and outlines. Use appropriate emojis for each rule and feature. Make it easy to read with emojis, boldface and outlines and titles (#, ##, ###, ####) along with (** around text for bold):'
|
646 |
-
specquery = specquery + WordGameRules
|
647 |
-
specresponse = chat_with_model(specquery)
|
648 |
-
all = all + specquery + ' ' + specresponse
|
649 |
-
st.write('๐Run 2 is Complete.')
|
650 |
-
SpeechSynthesis(response + ' ' + specresponse)
|
651 |
-
|
652 |
-
# ๐Run 3 - Coding Expert - Write a Streamlit Python program with app.py and requirements.txt
|
653 |
-
codequery = 'Write a streamlit python program which implements line for line each function and UI in the rule specification with coded features for each as a functionCreate a streamlit user interface for each for input and output for the user for each feature to play a complete word game called: '
|
654 |
-
codequery = codequery + query + '.'
|
655 |
-
codequery = codequery + 'Use python features for word game such as the python game here: '
|
656 |
-
codequery = codequery + WordGamePython
|
657 |
-
codequery = codequery + 'Create a visually appealing UI (plan and code them from specification) so the user has fun interacting with these game features so each should have a small ui possibly st.expander or use of select and list boxes etc to make the UI flow well having multiple action centers where the screen and text change due to random and lists with you adding lots of tables of words etc which make it fun: '
|
658 |
-
codequery = codequery + 'Also use the specification to serve as your feature set for the word game you are writing in python and streamlit. Include the entire specification as markdown inside the program.'
|
659 |
-
codequery = codequery + specresponse # feed forward expert output to next expert agent
|
660 |
-
coderesponse = chat_with_model(codequery)
|
661 |
-
all = all + codequery + ' ' + coderesponse
|
662 |
-
st.write('๐Run 3 is Complete.')
|
663 |
-
|
664 |
-
# todo - add back python execution located elsewhere here in comment. acw 2/24/2022/6:20
|
665 |
-
|
666 |
-
# ๐Run 4 - Code Completion Expert -
|
667 |
-
webquery = 'Revise and expand on features in my game for ' + query + '. For each python function, improve the feature by adding 3 to 5 code lines each that implements the feature and UI in detail for streamlit so the user can play each feature.'
|
668 |
-
#webquery = webquery + 'Please study my Javascript preferences on word game features here: '
|
669 |
-
webquery = webquery + WordGamePython2
|
670 |
-
#webquery = webquery + 'The objective of this exercise is to create a visually appealing UI so the user has fun interacting with these game features so each should use timers, randomness, word tables, and features found in word games in a dynamic html5 app with javascript which make it fun.'
|
671 |
-
webquery = webquery + 'use this code written in python and streamlit, expanding language features in python and streamlit functions along with popular third party python libraries.'
|
672 |
-
webquery = webquery + coderesponse # feed forward expert output to next expert agent
|
673 |
-
webresponse = chat_with_model(webquery)
|
674 |
-
all = all + webquery + ' ' + webresponse
|
675 |
-
st.write('๐Run 4 is Complete.')
|
676 |
-
|
677 |
-
response = response + specresponse + coderesponse + webresponse
|
678 |
-
filename = generate_filename(response, "md")
|
679 |
-
create_file(filename, query, response, should_save)
|
680 |
queries = query + specquery + codequery + webquery
|
681 |
|
682 |
return all # ๐Run--------------------------------------------------------
|
|
|
530 |
st.write(f"- {query}")
|
531 |
all=""
|
532 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
533 |
# ๐Run 1 - plain query
|
534 |
+
#response = chat_with_model(query)
|
535 |
+
response1 = chat_with_model45(query + result)
|
536 |
+
|
537 |
+
all = query + ' ' + response1
|
538 |
st.write('๐Run 1 is Complete.')
|
539 |
|
540 |
# ArXiv searcher ~-<>-~
|
|
|
554 |
# ๐Run PaperSummarizer
|
555 |
PaperSummarizer = ' Create a diagram graphical representation of this: Summarize this paper set with short emoji outlines and preserve links, shortening it significantly. Create emoji filled short summaries per paper structured as markdown tables and outlines and show full markdown code listing. '
|
556 |
result = str(result).replace('\n', ' ').replace('|', ' ')
|
557 |
+
response2 = chat_with_model45(PaperSummarizer + result)
|
558 |
all = query + ' ' + response
|
559 |
st.write('๐Run 3 - Paper Summarizer is Complete.')
|
560 |
|
561 |
# ๐Run AppSpecifier
|
562 |
AppSpecifier = ' Design and write a creative superpower creating specification for a genius coder which has the scientific methods of steps and functions defined in a multiple markdown topic table and outline ensemble which serves as a thesis and comprehensive plan to build.'
|
563 |
result = str(result).replace('\n', ' ').replace('|', ' ')
|
564 |
+
response3 = chat_with_model45(AppSpecifier + response2 + query)
|
565 |
st.write('๐Run 4 - AppSpecifier is Complete.')
|
566 |
|
567 |
# ๐Run PythonAppCoder
|
568 |
PythonAppCoder = ' Create a streamlit python app implementing the following list of features using appropriate libraries and function design using streamlit. Show full code listing as output with no commentary. '
|
569 |
result = str(result).replace('\n', ' ').replace('|', ' ')
|
570 |
+
response4 = chat_with_model45(PythonAppCoder + response3 + query)
|
571 |
st.write('๐Run Python AppCoder is Complete.')
|
572 |
|
573 |
# experimental 45 - - - - - - - - - - - - -<><><><><>
|
574 |
|
575 |
+
responseAll = query + response1 + response2 + response3 + response4
|
576 |
+
filename = generate_filename(responseAll, "md")
|
577 |
+
create_file(filename, query, responseAll, should_save)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
578 |
queries = query + specquery + codequery + webquery
|
579 |
|
580 |
return all # ๐Run--------------------------------------------------------
|