Spaces:
Running
Running
Feature(LLMLingua): build the LLMLingua space demo
Browse files
app.py
CHANGED
|
@@ -47,13 +47,10 @@ custom_css = """
|
|
| 47 |
}
|
| 48 |
"""
|
| 49 |
|
| 50 |
-
def compress_prompt(context,
|
| 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:
|