CobaltZvc commited on
Commit
7f25889
·
1 Parent(s): 6d92c30

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -28
app.py CHANGED
@@ -187,34 +187,34 @@ date_time = str(datetime.now())
187
  # dictionary = st.secrets("GSHEET_KEY")
188
  # json_object = json.dumps(dictionary, indent=4)
189
 
190
- def g_sheet_log(myinput, output):
191
- SERVICE_ACCOUNT_FILE = 'gsheet.json'
192
 
193
- credentials = service_account.Credentials.from_service_account_file(
194
- filename=SERVICE_ACCOUNT_FILE
195
- )
196
 
197
- service_sheets = build('sheets', 'v4', credentials=credentials)
198
 
199
- GOOGLE_SHEETS_ID = '16cM8lHm7n_X0ZVLgWfL5fcBhvKWIGO9LQz3zCl2Dn_8'
200
- worksheet_name = 'Prompt_Logs!'
201
- cell_range_insert = 'A:C'
202
 
203
- values = (
204
- (myinput, output, date_time),
205
- )
206
 
207
- value_range_body = {
208
- 'majorDimension' : 'ROWS',
209
- 'values' : values
210
- }
211
 
212
- service_sheets.spreadsheets().values().append(
213
- spreadsheetId=GOOGLE_SHEETS_ID,
214
- valueInputOption='USER_ENTERED',
215
- range=worksheet_name + cell_range_insert,
216
- body=value_range_body
217
- ).execute()
218
 
219
  openai.api_key = st.secrets["OPENAI_KEY"]
220
 
@@ -285,13 +285,13 @@ if Input_type == 'TEXT':
285
  img2 = Image.open(wget.download(openai_response(prompt)))
286
  img2.show()
287
  rx = 'Image returned'
288
- g_sheet_log(mytext, rx)
289
  except:
290
  urllib.request.urlretrieve(openai_response(prompt),"img_ret.png")
291
  img = Image.open("img_ret.png")
292
  img.show()
293
  rx = 'Image returned'
294
- g_sheet_log(mytext, rx)
295
  except:
296
  # Set up our initial generation parameters.
297
  answers = stability_api.generate(
@@ -324,7 +324,7 @@ if Input_type == 'TEXT':
324
  st.image(img)
325
  img.save(str(artifact.seed)+ ".png") # Save our generated images with their seed number as the filename.
326
  rx = 'Image returned'
327
- g_sheet_log(mytext, rx)
328
 
329
  # except:
330
  # st.write('image is being generated please wait...')
@@ -359,17 +359,17 @@ if Input_type == 'TEXT':
359
  st.write(OurURL)
360
  st_player(OurURL)
361
  ry = 'Youtube link and video returned'
362
- g_sheet_log(mytext, ry)
363
 
364
  elif ("don't" in string_temp or "internet" in string_temp):
365
  st.write('searching internet ')
366
  search_internet(question)
367
  rz = 'Internet result returned'
368
- g_sheet_log(mytext, string_temp)
369
 
370
  else:
371
  st.write(string_temp)
372
- g_sheet_log(mytext, string_temp)
373
 
374
  elif Input_type == 'SPEECH':
375
  option_speech = st.selectbox(
 
187
  # dictionary = st.secrets("GSHEET_KEY")
188
  # json_object = json.dumps(dictionary, indent=4)
189
 
190
+ # def g_sheet_log(myinput, output):
191
+ # SERVICE_ACCOUNT_FILE = 'gsheet.json'
192
 
193
+ # credentials = service_account.Credentials.from_service_account_file(
194
+ # filename=SERVICE_ACCOUNT_FILE
195
+ # )
196
 
197
+ # service_sheets = build('sheets', 'v4', credentials=credentials)
198
 
199
+ # GOOGLE_SHEETS_ID = '16cM8lHm7n_X0ZVLgWfL5fcBhvKWIGO9LQz3zCl2Dn_8'
200
+ # worksheet_name = 'Prompt_Logs!'
201
+ # cell_range_insert = 'A:C'
202
 
203
+ # values = (
204
+ # (myinput, output, date_time),
205
+ # )
206
 
207
+ # value_range_body = {
208
+ # 'majorDimension' : 'ROWS',
209
+ # 'values' : values
210
+ # }
211
 
212
+ # service_sheets.spreadsheets().values().append(
213
+ # spreadsheetId=GOOGLE_SHEETS_ID,
214
+ # valueInputOption='USER_ENTERED',
215
+ # range=worksheet_name + cell_range_insert,
216
+ # body=value_range_body
217
+ # ).execute()
218
 
219
  openai.api_key = st.secrets["OPENAI_KEY"]
220
 
 
285
  img2 = Image.open(wget.download(openai_response(prompt)))
286
  img2.show()
287
  rx = 'Image returned'
288
+ # g_sheet_log(mytext, rx)
289
  except:
290
  urllib.request.urlretrieve(openai_response(prompt),"img_ret.png")
291
  img = Image.open("img_ret.png")
292
  img.show()
293
  rx = 'Image returned'
294
+ # g_sheet_log(mytext, rx)
295
  except:
296
  # Set up our initial generation parameters.
297
  answers = stability_api.generate(
 
324
  st.image(img)
325
  img.save(str(artifact.seed)+ ".png") # Save our generated images with their seed number as the filename.
326
  rx = 'Image returned'
327
+ # g_sheet_log(mytext, rx)
328
 
329
  # except:
330
  # st.write('image is being generated please wait...')
 
359
  st.write(OurURL)
360
  st_player(OurURL)
361
  ry = 'Youtube link and video returned'
362
+ # g_sheet_log(mytext, ry)
363
 
364
  elif ("don't" in string_temp or "internet" in string_temp):
365
  st.write('searching internet ')
366
  search_internet(question)
367
  rz = 'Internet result returned'
368
+ # g_sheet_log(mytext, string_temp)
369
 
370
  else:
371
  st.write(string_temp)
372
+ # g_sheet_log(mytext, string_temp)
373
 
374
  elif Input_type == 'SPEECH':
375
  option_speech = st.selectbox(