Spaces:
Sleeping
Sleeping
Create app.py
#1
by
CoxMarius
- opened
app.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
# Creează pipeline-ul de rezumare
|
| 5 |
+
summarizer = pipeline("summarization", model="csebuetnlp/mT5_multilingual_XLSum")
|
| 6 |
+
|
| 7 |
+
# Funcția care face rezumatul
|
| 8 |
+
def rezuma_text(text):
|
| 9 |
+
summary = summarizer(text, max_length=100, min_length=30, do_sample=False)
|
| 10 |
+
return summary[0]['summary_text']
|
| 11 |
+
|
| 12 |
+
# Interfața Gradio
|
| 13 |
+
gr.Interface(
|
| 14 |
+
fn=rezuma_text,
|
| 15 |
+
inputs="text",
|
| 16 |
+
outputs="text",
|
| 17 |
+
title="SmartRezumat",
|
| 18 |
+
description="AI care transformă texte lungi în rezumate scurte, în limba română"
|
| 19 |
+
).launch()
|