valencar commited on
Commit
f5cdb22
·
verified ·
1 Parent(s): 908aa4d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -12
app.py CHANGED
@@ -1,9 +1,6 @@
1
- import datetime
2
  import streamlit as st
3
  import maritalk
4
 
5
- # question = "Name the planets in the solar system? A: " # question = "Quais são os planetas do sistema solar?" # question = "Qual é o maior planeta do sistema solar?"
6
-
7
  def init_model():
8
  model = maritalk.MariTalk(
9
  key="100479706496023140829_534ece7d352abf00",
@@ -18,18 +15,10 @@ def stream_response(model, message, max_tokens=200):
18
 
19
  # main()
20
  model = init_model()
21
- before = datetime.datetime.now()
22
  with st.container():
23
  st.write('\n\n')
24
  st.title('LLM-LANAChat-Brasil\n\n')
25
  message = st.text_input("Chat", placeholder="E ai?")
26
  if message:
27
  max_tokens = 200
28
- # for response in model.generate(message, max_tokens=max_tokens, stream=True):
29
- # st.write_stream(response)
30
- st.write_stream(stream_response(model, message, max_tokens))
31
-
32
- after = datetime.datetime.now()
33
- current_time = (after - before) # .strftime("%H:%M:%S")
34
- print("\nTime Elapsed: ", current_time)
35
- st.write("\nTime Elapsed: ", current_time)
 
 
1
  import streamlit as st
2
  import maritalk
3
 
 
 
4
  def init_model():
5
  model = maritalk.MariTalk(
6
  key="100479706496023140829_534ece7d352abf00",
 
15
 
16
  # main()
17
  model = init_model()
 
18
  with st.container():
19
  st.write('\n\n')
20
  st.title('LLM-LANAChat-Brasil\n\n')
21
  message = st.text_input("Chat", placeholder="E ai?")
22
  if message:
23
  max_tokens = 200
24
+ st.write_stream(stream_response(model, message, max_tokens))