Ridealist commited on
Commit
16a6f2b
โ€ข
1 Parent(s): ca19b5b

refactor: add TODO tag and delete unused comments

Browse files
Files changed (1) hide show
  1. vocal_app.py +3 -21
vocal_app.py CHANGED
@@ -298,14 +298,8 @@ def generate_response(prompt):
298
  response = completion.choices[0].message.content
299
  st.session_state['messages'].append({"role": "assistant", "content": response})
300
 
301
- # print(st.session_state['messages'])
302
- # total_tokens = completion.usage.total_tokens
303
- # prompt_tokens = completion.usage.prompt_tokens
304
- # completion_tokens = completion.usage.completion_tokens
305
 
306
- return response #, total_tokens, prompt_tokens, completion_tokens
307
-
308
- #TODO ์›…๊ธฐํ˜•์ด ์ถ”๊ฐ€ํ•ด๋†“์€ history ์„ธ์…˜ 3๊ฐ€์ง€ ์ถ”๊ฐ€ํ•ด๋†“๊ธฐ
309
  #TODO ์ „์ฒด ์œ ์ €๊ฐ€ ๋ฐœํ™”ํ•œ ์‹œ๊ฐ„ ๊ธฐ๋กํ•˜๊ธฐ -> ์„ธ์…˜์— ์ €์žฅ
310
 
311
  def page4():
@@ -361,6 +355,8 @@ def page4():
361
  container = st.container()
362
 
363
  with container:
 
 
364
  with st.form(key='my_form', clear_on_submit=True):
365
  user_input = st.text_area("You:", key='input', height=100)
366
  submit_buttom = st.form_submit_button(label='Send')
@@ -377,17 +373,6 @@ def page4():
377
  )
378
  st.session_state['past'].append(user_input)
379
  st.session_state['generated'].append(output)
380
- # st.session_state['model_name'].append(model_name)
381
- # st.session_state['total_tokens'].append(total_tokens)
382
-
383
- # from https://openai.com/pricing#language-models
384
- # if model_name == "GPT-3.5":
385
- # cost = total_tokens * 0.002 / 1000
386
- # else:
387
- # cost = (prompt_tokens * 0.03 + completion_tokens * 0.06) / 1000
388
-
389
- # st.session_state['cost'].append(cost)
390
- # st.session_state['total_cost'] += cost
391
 
392
  if st.session_state['generated']:
393
  with response_container:
@@ -395,9 +380,6 @@ def page4():
395
  for i in range(len(st.session_state['past'])):
396
  message(st.session_state["past"][i], is_user=True, key=str(i) + '_user')
397
  message(st.session_state["generated"][i + 1], key=str(i + 1))
398
- # st.write(
399
- # f"Model used: {st.session_state['model_name'][i]}; Number of tokens: {st.session_state['total_tokens'][i]}; Cost: ${st.session_state['cost'][i]:.5f}"
400
- # )
401
 
402
 
403
  print(st.session_state)
 
298
  response = completion.choices[0].message.content
299
  st.session_state['messages'].append({"role": "assistant", "content": response})
300
 
301
+ return response
 
 
 
302
 
 
 
 
303
  #TODO ์ „์ฒด ์œ ์ €๊ฐ€ ๋ฐœํ™”ํ•œ ์‹œ๊ฐ„ ๊ธฐ๋กํ•˜๊ธฐ -> ์„ธ์…˜์— ์ €์žฅ
304
 
305
  def page4():
 
355
  container = st.container()
356
 
357
  with container:
358
+ #TODO (์›…๊ธฐํ˜•) : STT ๋ถ™์ด๋Š” ๋ถ€๋ถ„
359
+ #TODO user_input์— ์Œ์„ฑ์ธ์‹๋œ text๋ฅผ ์ „๋‹ฌํ•ด์ฃผ๋ฉด ๋จ
360
  with st.form(key='my_form', clear_on_submit=True):
361
  user_input = st.text_area("You:", key='input', height=100)
362
  submit_buttom = st.form_submit_button(label='Send')
 
373
  )
374
  st.session_state['past'].append(user_input)
375
  st.session_state['generated'].append(output)
 
 
 
 
 
 
 
 
 
 
 
376
 
377
  if st.session_state['generated']:
378
  with response_container:
 
380
  for i in range(len(st.session_state['past'])):
381
  message(st.session_state["past"][i], is_user=True, key=str(i) + '_user')
382
  message(st.session_state["generated"][i + 1], key=str(i + 1))
 
 
 
383
 
384
 
385
  print(st.session_state)