lagy commited on
Commit
adc0c9b
·
verified ·
1 Parent(s): f33590a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -50,7 +50,6 @@ def generate(model,tokenizer,instruction,context,streamer):
50
  output = output.split("###")[3].split("<|endoftext|>", 1)[0]
51
  return output
52
 
53
-
54
  @st.cache_resource
55
  def get_model():
56
  # Create a model of the specified type.
@@ -85,7 +84,12 @@ if st.button('Generate'):
85
 
86
  next(streamer)
87
 
88
- st.write_stream(streamer)
 
 
 
 
 
89
 
90
  #for new_text in streamer:
91
  #i += 1
 
50
  output = output.split("###")[3].split("<|endoftext|>", 1)[0]
51
  return output
52
 
 
53
  @st.cache_resource
54
  def get_model():
55
  # Create a model of the specified type.
 
84
 
85
  next(streamer)
86
 
87
+ def iterator():
88
+ for new_text in streamer:
89
+ new_text = new_text.split("<|endoftext|>", 1)[0]
90
+ yield new_text
91
+
92
+ st.write_stream(iterator)
93
 
94
  #for new_text in streamer:
95
  #i += 1