This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def main(): | |
st.markdown("<h1 style='text-align: center;'>FILL_ME_UP 記入</h1>", unsafe_allow_html=True)#人工知能 | |
# st.title("FILL_ME_UP") | |
link = st.text_input("Enter the Google Forms link:") | |
if st.button("Generate Responses"): | |
if link: | |
form_parts = get_form_text(link) | |
responses = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_form_text(link): | |
url = link | |
response = requests.get(url) | |
soup = BeautifulSoup(response.content, 'html.parser') | |
code = soup.text.strip() | |
# Use regular expression to split the text based on multiple delimiters | |
delimiters = ["Your answer", "Your email address", "Date"] | |
pattern = "|".join(map(re.escape, delimiters)) | |
parts = re.split(pattern, code) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openai.api_key = 'Your API key' | |
def generate_text(prompt): | |
responseObject = openai.ChatCompletion.create( | |
model="gpt-3.5-turbo", | |
messages=[ | |
{"role": "system", "content": "Answer the questions as a student filling the form. (Write good big answers)(If the question has options select the correct option)"}, | |
{"role": "user", "content": prompt}, | |
], | |
max_tokens=256 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import streamlit as st | |
import openai | |
import requests | |
from bs4 import BeautifulSoup | |
import re |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while True: | |
if time.strftime('%M') == '00': | |
notify(gen('Give me validation and motivation to get through my day. (give a simple paragraph of 25 words as output.)')) | |
print('Did my job going to sleep now byeeee <3 ', time.strftime("%H:%M:%S")) | |
time.sleep(50 * 60) | |
print('I am awake now, Back to work. ', time.strftime("%H:%M:%S")) | |
else: | |
continue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def notify(message): | |
from plyer import notification | |
notification.notify( | |
title='Valid San :3', | |
message=message, | |
app_icon=None, | |
timeout=30, | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def gen(prompt): | |
openai.api_key = "your api key" | |
response = openai.Completion.create( | |
engine="text-davinci-003", | |
prompt=prompt, | |
temperature=0.7, | |
max_tokens=1000, | |
top_p=1.0, | |
frequency_penalty=0.0, | |
presence_penalty=0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if __name__ == '__main__': | |
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def main(): | |
running = True | |
playing = False | |
count = 0 | |
update_freq = 1 | |
positions = set() | |
# positions.add((10,10)) | |
while running: | |
clock.tick(FPS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_neighbours(pos): | |
x,y = pos | |
neighbors = [] | |
for dx in [-1,0,1]: | |
if x + dx < 0 or x + dx >= GRID_WIDTH: | |
continue | |
for dy in [-1,0,1]: | |
if y + dy < 0 or y + dy >= GRID_HEIGHT: | |
continue | |
if dx == 0 and dy == 0: |
NewerOlder