RamAnanth1 commited on
Commit
ec187f6
1 Parent(s): b289559

Modify response to use streaming

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -12,7 +12,11 @@ theme = gr.themes.Monochrome(
12
 
13
  instruct_pipeline = pipeline(model="databricks/dolly-v2-12b", torch_dtype=torch.bfloat16, trust_remote_code=True, device_map="auto")
14
  def generate(instruction):
15
- return instruct_pipeline(instruction)
 
 
 
 
16
 
17
 
18
  examples = [
 
12
 
13
  instruct_pipeline = pipeline(model="databricks/dolly-v2-12b", torch_dtype=torch.bfloat16, trust_remote_code=True, device_map="auto")
14
  def generate(instruction):
15
+ response = instruct_pipeline(instruction)
16
+ result = ""
17
+ for word in response.split(" "):
18
+ result += word + " "
19
+ yield result
20
 
21
 
22
  examples = [