Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,7 +5,7 @@ import torch
|
|
| 5 |
import os
|
| 6 |
|
| 7 |
# ---- Config ----
|
| 8 |
-
MODEL_ID = os.getenv("HF_MODEL_ID", "
|
| 9 |
# Set CPU threads modestly to avoid aggressive memory/CPU usage in Spaces
|
| 10 |
torch.set_num_threads(2)
|
| 11 |
|
|
@@ -50,7 +50,7 @@ def simplify(text: str, max_new_tokens: int = 60) -> str:
|
|
| 50 |
|
| 51 |
# ---- Gradio UI ----
|
| 52 |
with gr.Blocks(css=".gradio-container {max-width:1100px}") as demo:
|
| 53 |
-
gr.Markdown("# NL tekst vereenvoudiger (test)\nGebruik een klein Nederlands model:
|
| 54 |
with gr.Row():
|
| 55 |
txt = gr.Textbox(label="Brontekst (Nederlands)", lines=8, placeholder="Plak hier een artikel of paragraaf...")
|
| 56 |
out = gr.Textbox(label="Vereenvoudigde tekst", lines=8)
|
|
@@ -60,12 +60,11 @@ with gr.Blocks(css=".gradio-container {max-width:1100px}") as demo:
|
|
| 60 |
run_btn.click(fn=simplify, inputs=[txt, tokens], outputs=out)
|
| 61 |
gr.Examples(
|
| 62 |
examples=[
|
| 63 |
-
["
|
| 64 |
-
["
|
| 65 |
],
|
| 66 |
inputs=txt,
|
| 67 |
)
|
| 68 |
-
gr.Markdown("**Tips:** Als de Space tijdens build OOM geeft, kies een kleiner model of verlaag `max_new_tokens`.")
|
| 69 |
|
| 70 |
if __name__ == "__main__":
|
| 71 |
demo.launch()
|
|
|
|
| 5 |
import os
|
| 6 |
|
| 7 |
# ---- Config ----
|
| 8 |
+
MODEL_ID = os.getenv("HF_MODEL_ID", "tensorblock/fietje-2-instruct-GGUF")
|
| 9 |
# Set CPU threads modestly to avoid aggressive memory/CPU usage in Spaces
|
| 10 |
torch.set_num_threads(2)
|
| 11 |
|
|
|
|
| 50 |
|
| 51 |
# ---- Gradio UI ----
|
| 52 |
with gr.Blocks(css=".gradio-container {max-width:1100px}") as demo:
|
| 53 |
+
gr.Markdown(f"# NL tekst vereenvoudiger (test)\nGebruik een klein Nederlands model: {MODEL_ID}")
|
| 54 |
with gr.Row():
|
| 55 |
txt = gr.Textbox(label="Brontekst (Nederlands)", lines=8, placeholder="Plak hier een artikel of paragraaf...")
|
| 56 |
out = gr.Textbox(label="Vereenvoudigde tekst", lines=8)
|
|
|
|
| 60 |
run_btn.click(fn=simplify, inputs=[txt, tokens], outputs=out)
|
| 61 |
gr.Examples(
|
| 62 |
examples=[
|
| 63 |
+
["Example 1"],
|
| 64 |
+
["Example 2"],
|
| 65 |
],
|
| 66 |
inputs=txt,
|
| 67 |
)
|
|
|
|
| 68 |
|
| 69 |
if __name__ == "__main__":
|
| 70 |
demo.launch()
|