Spaces:
Runtime error
Runtime error
Nick Canu
commited on
Commit
·
02c682c
1
Parent(s):
389051c
final app push
Browse files- .streamlit/config.toml +1 -1
- Home.py +31 -15
- Persistent_Data/Feedback.csv +2 -0
- Tuning Data/final_tuning.csv +10 -0
- Tuning Data/final_tuning.parquet.gzip +3 -0
- Tuning Data/mem_test.parquet.gzip +3 -0
- requirements.txt +0 -1
- title_generator.py +8 -8
.streamlit/config.toml
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
[theme]
|
2 |
primaryColor="#e76020"
|
3 |
backgroundColor="#FDFFFC"
|
4 |
-
secondaryBackgroundColor="#
|
5 |
textColor="#0f0f0d"
|
6 |
font="monospace"
|
|
|
1 |
[theme]
|
2 |
primaryColor="#e76020"
|
3 |
backgroundColor="#FDFFFC"
|
4 |
+
secondaryBackgroundColor="#6E896A"
|
5 |
textColor="#0f0f0d"
|
6 |
font="monospace"
|
Home.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import streamlit as st
|
|
|
2 |
import boto3
|
3 |
|
4 |
st.set_page_config(page_title='Auto-BG: The Game Concept Generator', layout='wide')
|
@@ -20,6 +21,7 @@ def application():
|
|
20 |
from datetime import date
|
21 |
from description_generator import input_manager, model_control
|
22 |
from pathlib import Path
|
|
|
23 |
|
24 |
#S3 Bucket
|
25 |
session = boto3.Session(aws_access_key_id=st.secrets.accesskey, aws_secret_access_key=st.secrets.secretaccesskey)
|
@@ -358,23 +360,31 @@ def blog():
|
|
358 |
"""
|
359 |
Blog describing the Auto-BG project
|
360 |
"""
|
361 |
-
|
362 |
-
|
363 |
-
st.
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
368 |
|
369 |
def about_us():
|
370 |
"""
|
371 |
About us page describing creators of Auto-BG
|
372 |
"""
|
373 |
-
|
374 |
-
st.
|
375 |
-
st.
|
376 |
-
|
377 |
-
|
|
|
378 |
|
379 |
# Columns containing information on each of the creators
|
380 |
col1, col2, col3 = st.columns([1,1,1])
|
@@ -384,7 +394,9 @@ def about_us():
|
|
384 |
st.subheader('Nick Canu')
|
385 |
st.write("""
|
386 |
**University of Michigan**\n
|
387 |
-
|
|
|
|
|
388 |
""")
|
389 |
|
390 |
with col2:
|
@@ -392,7 +404,9 @@ def about_us():
|
|
392 |
st.subheader('Taylor Druhot')
|
393 |
st.write("""
|
394 |
**University of Michigan**\n
|
395 |
-
|
|
|
|
|
396 |
""")
|
397 |
|
398 |
with col3:
|
@@ -400,7 +414,9 @@ def about_us():
|
|
400 |
st.subheader('Sebastian Capp')
|
401 |
st.write("""
|
402 |
**University of Michigan**\n
|
403 |
-
|
|
|
|
|
404 |
""")
|
405 |
|
406 |
def feedback():
|
|
|
1 |
import streamlit as st
|
2 |
+
import base64
|
3 |
import boto3
|
4 |
|
5 |
st.set_page_config(page_title='Auto-BG: The Game Concept Generator', layout='wide')
|
|
|
21 |
from datetime import date
|
22 |
from description_generator import input_manager, model_control
|
23 |
from pathlib import Path
|
24 |
+
import base64
|
25 |
|
26 |
#S3 Bucket
|
27 |
session = boto3.Session(aws_access_key_id=st.secrets.accesskey, aws_secret_access_key=st.secrets.secretaccesskey)
|
|
|
360 |
"""
|
361 |
Blog describing the Auto-BG project
|
362 |
"""
|
363 |
+
st.write('### Auto-BG: The Board Game Concept Generator')
|
364 |
+
st.write("#### Abstract")
|
365 |
+
st.write("*This application augments one step in the board game design process by generating potential full game concepts from a collection of descriptive tags.\
|
366 |
+
Auto-BG uses a custom pipeline of GPT3 and T5 models to create a new description and proposed titles for a game that doesn't exist today.\
|
367 |
+
These concepts support general users and designers-to-be as alternatives to current concepts, seeds for future concepts, or an entertaining thought experiment.*")
|
368 |
+
|
369 |
+
# Code adapted from "Display and Download PDF in Streamlit: A Blog Use Case" by My Data Talk, https://towardsdatascience.com/display-and-download-pdf-in-streamlit-a-blog-use-case-5fc1ac87d4b1
|
370 |
+
with open('Auto_BG_blog.pdf', "rb") as blog_file:
|
371 |
+
blog_pdf = base64.b64encode(blog_file.read()).decode('utf-8')
|
372 |
+
blog_display = f'<center><iframe src="data:application/pdf;base64,{blog_pdf}" width=800 height=800 type="application/pdf"></iframe><center>'
|
373 |
+
|
374 |
+
st.markdown(blog_display, unsafe_allow_html=True)
|
375 |
+
|
376 |
+
|
377 |
|
378 |
def about_us():
|
379 |
"""
|
380 |
About us page describing creators of Auto-BG
|
381 |
"""
|
382 |
+
|
383 |
+
st.write('### Creators of Auto-BG')
|
384 |
+
st.write('*With a shared love of data science and board games, we came together and created Auto-BG as a Capstone project\
|
385 |
+
in the "Master of Applied Data Science" program at the University of Michigan.\
|
386 |
+
We hope you enjoy!*')
|
387 |
+
st.write("\n")
|
388 |
|
389 |
# Columns containing information on each of the creators
|
390 |
col1, col2, col3 = st.columns([1,1,1])
|
|
|
394 |
st.subheader('Nick Canu')
|
395 |
st.write("""
|
396 |
**University of Michigan**\n
|
397 |
+
***Master of Applied Data Science, Class of 2023***\n
|
398 |
+
N. Canu trained, evaluated, & implemented pipeline classes text and title generator models for Auto-BG.\n
|
399 |
+
Their current board game obsession is Obsession by Kayenta Games.
|
400 |
""")
|
401 |
|
402 |
with col2:
|
|
|
404 |
st.subheader('Taylor Druhot')
|
405 |
st.write("""
|
406 |
**University of Michigan**\n
|
407 |
+
***Master of Applied Data Science, Class of 2023***\n
|
408 |
+
T. Druhot scoped and designed the Streamlit application. He also built the UI front end & title generator final module, and integrated modules into live application.\n
|
409 |
+
Avid Magic the Gathering Limited player and deck/engine building board games.
|
410 |
""")
|
411 |
|
412 |
with col3:
|
|
|
414 |
st.subheader('Sebastian Capp')
|
415 |
st.write("""
|
416 |
**University of Michigan**\n
|
417 |
+
***Master of Applied Data Science, Class of 2023***\n
|
418 |
+
S. Capp contributed research, text generator prototyping, streamlit application modules, and visualizations.\n
|
419 |
+
Immense fan of Catan, Coup, and any deduction games.
|
420 |
""")
|
421 |
|
422 |
def feedback():
|
Persistent_Data/Feedback.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
,feedback
|
2 |
+
0,
|
Tuning Data/final_tuning.csv
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
vals,precision,recall,f1,rouge1,rouge2,rougeL,bleurt
|
2 |
+
.4.6,0.839104,0.823205,0.830972,0.286055,0.032162,0.137387,-0.658947
|
3 |
+
.5.6,0.830372,0.822095,0.826054,0.271715,0.02905,0.128324,-0.694956
|
4 |
+
.7.6,0.828157,0.82092,0.82436,0.260092,0.026194,0.122711,-0.7378
|
5 |
+
.4.7,0.844516,0.821091,0.832507,0.260654,0.031788,0.129768,-0.759018
|
6 |
+
.5.7,0.836557,0.823989,0.830086,0.282257,0.039041,0.134946,-0.638258
|
7 |
+
.7.7,0.831543,0.81901,0.825074,0.245687,0.029726,0.121534,-0.782465
|
8 |
+
.4.8,0.834656,0.822824,0.828583,0.26926,0.0295,0.12909,-0.700632
|
9 |
+
.5.8,0.839928,0.825867,0.832719,0.280697,0.036367,0.137291,-0.6554
|
10 |
+
.7.8,0.828769,0.822225,0.8253,0.260533,0.026237,0.121529,-0.69857
|
Tuning Data/final_tuning.parquet.gzip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a93c53f3b4e0caaf39a227adaba92200cad20a6577f482b227d60d524056b894
|
3 |
+
size 200221
|
Tuning Data/mem_test.parquet.gzip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6012869d662ba2e95a27a7486863a03491c15fbc205c8c4001b68735c960ea75
|
3 |
+
size 176763
|
requirements.txt
CHANGED
@@ -9,4 +9,3 @@ spacy==3.5.0
|
|
9 |
streamlit==1.20.0
|
10 |
torch==1.13.1
|
11 |
transformers==4.26.1
|
12 |
-
sentencepiece==0.1.97
|
|
|
9 |
streamlit==1.20.0
|
10 |
torch==1.13.1
|
11 |
transformers==4.26.1
|
|
title_generator.py
CHANGED
@@ -75,22 +75,22 @@ class Title_Generator:
|
|
75 |
def candidate_score(self,candidates,ex_check=None):
|
76 |
|
77 |
|
78 |
-
|
79 |
-
|
80 |
-
|
|
|
|
|
|
|
81 |
|
82 |
|
83 |
if re.search(re.compile(re.escape("__")), desc):
|
|
|
84 |
hold = candidates[0]
|
85 |
gen_desc = re.sub(re.compile(re.escape("__")),"",desc)
|
86 |
candidates = self.candidate_generator(gen_desc)
|
87 |
-
next = candidates[0]+hold
|
88 |
candidates = (next, desc)
|
89 |
|
90 |
-
reg = re.compile("("+"|".join(ex_check) + ")")
|
91 |
-
step = [cand for cand in candidates[0] if not reg.search(cand)]
|
92 |
-
candidates = (step,candidates[1])
|
93 |
-
|
94 |
#check for existing games and duplicates
|
95 |
#transform function from https://stackoverflow.com/questions/42165779/python-how-to-remove-duplicate-valuescase-insensitive-from-a-list-with-same-o
|
96 |
def transform(L):
|
|
|
75 |
def candidate_score(self,candidates,ex_check=None):
|
76 |
|
77 |
|
78 |
+
if ex_check != None:
|
79 |
+
pat = re.compile("((?:" + "|".join(map(re.escape, candidates[0]+[cand.upper() for cand in candidates[0]])) + "|" + "|".join(ex_check) +"))")
|
80 |
+
desc = re.sub(pat, "__", candidates[1])
|
81 |
+
else:
|
82 |
+
pat = re.compile("((?:" + "|".join(map(re.escape, candidates[0]+[cand.upper() for cand in candidates[0]])) + "))")
|
83 |
+
desc = re.sub(pat, "__", candidates[1])
|
84 |
|
85 |
|
86 |
if re.search(re.compile(re.escape("__")), desc):
|
87 |
+
reg = re.compile("("+"|".join(ex_check) + ")")
|
88 |
hold = candidates[0]
|
89 |
gen_desc = re.sub(re.compile(re.escape("__")),"",desc)
|
90 |
candidates = self.candidate_generator(gen_desc)
|
91 |
+
next = [cand for cand in candidates[0]+hold if not reg.search(cand)]
|
92 |
candidates = (next, desc)
|
93 |
|
|
|
|
|
|
|
|
|
94 |
#check for existing games and duplicates
|
95 |
#transform function from https://stackoverflow.com/questions/42165779/python-how-to-remove-duplicate-valuescase-insensitive-from-a-list-with-same-o
|
96 |
def transform(L):
|