Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from transformers import pipeline | |
| pipe = pipeline( | |
| "text2text-generation", | |
| model="google/flan-t5-xl", | |
| max_new_tokens=256 | |
| ) | |
| def analyze(text): | |
| prompt = f""" | |
| TASK: | |
| Extract key facts from the following business document. | |
| INSTRUCTIONS: | |
| - Use short phrases, not full sentences | |
| - Do not repeat the document verbatim | |
| - No polite language | |
| - If a value is not mentioned, write "N/A" | |
| Return the result in exactly this format: | |
| Offer amount: | |
| Budget limit: | |
| Reply deadline: | |
| Delivery time: | |
| Decision options: | |
| Document: | |
| {text} | |
| """ | |
| return pipe(prompt)[0]["generated_text"] | |
| gr.Interface( | |
| fn=analyze, | |
| inputs=gr.Textbox(lines=10, label="Text eingeben"), | |
| outputs=gr.Textbox(lines=15, label="Ergebnis"), | |
| title="Business-Text-Analyse (FLAN-T5)" | |
| ).launch() | |