Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,18 +1,16 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
-
# Creează pipeline-ul de rezumare
|
| 5 |
summarizer = pipeline("summarization", model="IonutBot/mt5-ro-summarizer")
|
| 6 |
-
|
| 7 |
-
def rezuma_text(text):
|
| 8 |
-
summary = summarizer(text, max_length=
|
| 9 |
return summary[0]['summary_text']
|
| 10 |
|
| 11 |
-
# Interfața Gradio
|
| 12 |
gr.Interface(
|
| 13 |
fn=rezuma_text,
|
| 14 |
-
inputs="
|
| 15 |
outputs="text",
|
| 16 |
title="SmartRezumat",
|
| 17 |
description="AI care transformă texte lungi în rezumate scurte, în limba română"
|
| 18 |
-
).launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
|
|
|
|
| 4 |
summarizer = pipeline("summarization", model="IonutBot/mt5-ro-summarizer")
|
| 5 |
+
|
| 6 |
+
def rezuma_text(text, lungime):
|
| 7 |
+
summary = summarizer(text, max_length=lungime, min_length=int(lungime * 0.4), do_sample=False)
|
| 8 |
return summary[0]['summary_text']
|
| 9 |
|
|
|
|
| 10 |
gr.Interface(
|
| 11 |
fn=rezuma_text,
|
| 12 |
+
inputs=[gr.Textbox(label="Text de rezumat"), gr.Slider(50, 300, value=150, label="Lungime maximă")],
|
| 13 |
outputs="text",
|
| 14 |
title="SmartRezumat",
|
| 15 |
description="AI care transformă texte lungi în rezumate scurte, în limba română"
|
| 16 |
+
).launch()
|