Spaces:
Runtime error
Runtime error
twdruhot
commited on
Commit
·
0c79d4a
1
Parent(s):
750aba0
Finished with report and feedback buttons to store data to s3 bucket
Browse files- Home.py +22 -19
- Persistent_Data/Feedback.csv +0 -2
Home.py
CHANGED
|
@@ -19,7 +19,11 @@ def application():
|
|
| 19 |
from datetime import date
|
| 20 |
from description_generator import input_manager, model_control
|
| 21 |
from pathlib import Path
|
| 22 |
-
import
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
#UI Session Variables
|
| 25 |
if 'desc_iter' not in st.session_state:
|
|
@@ -140,16 +144,14 @@ def application():
|
|
| 140 |
data = {'rprtd': date.today(),'inpts': inputs, 'title': st.session_state.output_dict[st.session_state.desc_iter]['titles'][st.session_state.title_iter][0], 'desc':st.session_state.output_dict[st.session_state.desc_iter]['text']}
|
| 141 |
r_df = pd.DataFrame(data, index=[0])
|
| 142 |
try:
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
|
|
|
| 146 |
w_p = w_p.drop_duplicates()
|
| 147 |
-
|
| 148 |
-
r_d.save_to_disk('reported.json')
|
| 149 |
except:
|
| 150 |
-
|
| 151 |
-
r_d.save_to_disk('reported.json')
|
| 152 |
-
|
| 153 |
|
| 154 |
###Variables
|
| 155 |
|
|
@@ -192,7 +194,6 @@ def application():
|
|
| 192 |
Discover the concept for your next favorite game!
|
| 193 |
|
| 194 |
How do you use Auto-BG?
|
| 195 |
-
|
| 196 |
Pick any set of tags from four selectors below: Family, Game, Mechanic, and Category.
|
| 197 |
If you are looking to lose together - activate the cooperative toggle.
|
| 198 |
|
|
@@ -407,21 +408,23 @@ def about_us():
|
|
| 407 |
def feedback():
|
| 408 |
import pandas as pd
|
| 409 |
from pathlib import Path
|
| 410 |
-
import
|
| 411 |
-
|
|
|
|
|
|
|
| 412 |
st.subheader('Leave comments below')
|
| 413 |
|
| 414 |
with st.form('feed',clear_on_submit=True):
|
| 415 |
f = st.text_area('Feedback')
|
| 416 |
sub = st.form_submit_button('Submit')
|
| 417 |
-
|
| 418 |
if sub:
|
| 419 |
-
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
| 425 |
|
| 426 |
|
| 427 |
with tab1:
|
|
|
|
| 19 |
from datetime import date
|
| 20 |
from description_generator import input_manager, model_control
|
| 21 |
from pathlib import Path
|
| 22 |
+
import boto3
|
| 23 |
+
|
| 24 |
+
#S3 Bucket
|
| 25 |
+
session = boto3.Session(aws_access_key_id=st.secrets.accesskey, aws_secret_access_key=st.secrets.secretaccesskey)
|
| 26 |
+
|
| 27 |
|
| 28 |
#UI Session Variables
|
| 29 |
if 'desc_iter' not in st.session_state:
|
|
|
|
| 144 |
data = {'rprtd': date.today(),'inpts': inputs, 'title': st.session_state.output_dict[st.session_state.desc_iter]['titles'][st.session_state.title_iter][0], 'desc':st.session_state.output_dict[st.session_state.desc_iter]['text']}
|
| 145 |
r_df = pd.DataFrame(data, index=[0])
|
| 146 |
try:
|
| 147 |
+
s3=session.client('s3')
|
| 148 |
+
reportedjson = s3.get_object(Bucket='auto-bg', Key='reported.json')
|
| 149 |
+
r_d = pd.read_json(reportedjson.get("Body"))
|
| 150 |
+
w_p = pd.concat([r_df, r_d])
|
| 151 |
w_p = w_p.drop_duplicates()
|
| 152 |
+
s3.put_object(Body=w_p.to_json() ,Bucket='auto-bg', Key='reported.json')
|
|
|
|
| 153 |
except:
|
| 154 |
+
s3.put_object(Body=r_df.to_json() ,Bucket='auto-bg', Key='reported.json')
|
|
|
|
|
|
|
| 155 |
|
| 156 |
###Variables
|
| 157 |
|
|
|
|
| 194 |
Discover the concept for your next favorite game!
|
| 195 |
|
| 196 |
How do you use Auto-BG?
|
|
|
|
| 197 |
Pick any set of tags from four selectors below: Family, Game, Mechanic, and Category.
|
| 198 |
If you are looking to lose together - activate the cooperative toggle.
|
| 199 |
|
|
|
|
| 408 |
def feedback():
|
| 409 |
import pandas as pd
|
| 410 |
from pathlib import Path
|
| 411 |
+
import boto3
|
| 412 |
+
|
| 413 |
+
session = boto3.Session(aws_access_key_id=st.secrets.accesskey, aws_secret_access_key=st.secrets.secretaccesskey)
|
| 414 |
+
|
| 415 |
st.subheader('Leave comments below')
|
| 416 |
|
| 417 |
with st.form('feed',clear_on_submit=True):
|
| 418 |
f = st.text_area('Feedback')
|
| 419 |
sub = st.form_submit_button('Submit')
|
| 420 |
+
|
| 421 |
if sub:
|
| 422 |
+
s3=session.client('s3')
|
| 423 |
+
feedbackcsv = s3.get_object(Bucket='auto-bg', Key='Feedback.csv')
|
| 424 |
+
f_f = pd.read_csv(feedbackcsv.get("Body"))
|
| 425 |
+
f_s = pd.DataFrame({'feedback':f}, index=[0])
|
| 426 |
+
f_f = pd.concat([f_f, f_s])
|
| 427 |
+
s3.put_object(Body=f_f.to_csv() ,Bucket='auto-bg', Key='Feedback.csv')
|
| 428 |
|
| 429 |
|
| 430 |
with tab1:
|
Persistent_Data/Feedback.csv
DELETED
|
@@ -1,2 +0,0 @@
|
|
| 1 |
-
,feedback
|
| 2 |
-
0,
|
|
|
|
|
|
|
|
|