iofu728 commited on
Commit
20c8875
1 Parent(s): 0db3dd6

Feature(LLMLingua): build the LLMLingua space demo

Browse files
Files changed (1) hide show
  1. app.py +2 -5
app.py CHANGED
@@ -47,13 +47,10 @@ custom_css = """
47
  }
48
  """
49
 
50
- def compress_prompt(context, instruct, question, ratio, target_token):
51
  compressed_prompt = llm_lingua.compress_prompt(context.split("\n\n"), instruction, question, ratio, target_token)
52
 
53
- return [compressed_prompt[key] for key in ["compressed_prompt", "origin_tokens", "compressed_tokens", "ratio", "saving"]]
54
-
55
- iface = gr.Interface(fn=compress_prompt, inputs="text", outputs="text")
56
- iface.launch()
57
 
58
 
59
  with gr.Blocks(css=custom_css) as iface:
 
47
  }
48
  """
49
 
50
+ def compress_prompt(context, instruction, question, ratio, target_token):
51
  compressed_prompt = llm_lingua.compress_prompt(context.split("\n\n"), instruction, question, ratio, target_token)
52
 
53
+ return *[compressed_prompt[key] for key in ["compressed_prompt", "origin_tokens", "compressed_tokens", "ratio", "saving"]]
 
 
 
54
 
55
 
56
  with gr.Blocks(css=custom_css) as iface: