RamAnanth1 commited on
Commit
6e8442c
1 Parent(s): 2dd04ea

switch to using streaming

Browse files
Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -21,13 +21,11 @@ generate_text = InstructionTextGenerationPipeline(model=model, tokenizer=tokeniz
21
 
22
  def generate(instruction):
23
  response = generate_text(instruction)
24
- # result = ""
25
- # for word in response.split(" "):
26
- # result += word + " "
27
- # yield result
28
- return response
29
-
30
-
31
  examples = [
32
  "Instead of making a peanut butter and jelly sandwich, what else could I combine peanut butter with in a sandwich? Give five ideas",
33
  "How do I make a campfire?",
 
21
 
22
  def generate(instruction):
23
  response = generate_text(instruction)
24
+ result = ""
25
+ for word in response.split(" "):
26
+ result += word + " "
27
+ yield result
28
+
 
 
29
  examples = [
30
  "Instead of making a peanut butter and jelly sandwich, what else could I combine peanut butter with in a sandwich? Give five ideas",
31
  "How do I make a campfire?",