awacke1 commited on
Commit
db967aa
1 Parent(s): 8fdca28

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -1
app.py CHANGED
@@ -25,13 +25,28 @@ gen_kwargs = dict(
25
  )
26
  prompt = f"Write instructions to teach anyone to write a discharge plan. List the entities, features and relationships to CCDA and FHIR objects in boldface."
27
  stream = client.text_generation(prompt, stream=True, details=True, **gen_kwargs)
 
 
 
 
28
  for r in stream:
29
  if r.token.special:
30
  continue
31
  if r.token.text in gen_kwargs["stop_sequences"]:
32
  break
 
 
 
 
 
 
 
 
 
 
 
33
  #st.markdown(r.token.text, end = "")
34
- st.write(r.token.text)
35
 
36
 
37
  def query(payload):
 
25
  )
26
  prompt = f"Write instructions to teach anyone to write a discharge plan. List the entities, features and relationships to CCDA and FHIR objects in boldface."
27
  stream = client.text_generation(prompt, stream=True, details=True, **gen_kwargs)
28
+ report=[]
29
+ res_box = st.empty()
30
+ collected_chunks=[]
31
+ collected_messages=[]
32
  for r in stream:
33
  if r.token.special:
34
  continue
35
  if r.token.text in gen_kwargs["stop_sequences"]:
36
  break
37
+ collected_chunks.append(r.token.text)
38
+ #chunk_message = r.token.text
39
+ collected_messages.append(chunk_message)
40
+
41
+ try:
42
+ report.append(content)
43
+ if len(r.token.text) > 0:
44
+ result="".join(report).strip()
45
+ res_box.markdown(f'*{result}*')
46
+
47
+ #full_reply = ''.join()
48
  #st.markdown(r.token.text, end = "")
49
+ #st.write(r.token.text)
50
 
51
 
52
  def query(payload):