Create 12
Browse files
12
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
# تحميل موديل التلخيص المجاني
|
| 5 |
+
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
|
| 6 |
+
|
| 7 |
+
# دالة التلخيص
|
| 8 |
+
def summarize(text):
|
| 9 |
+
if len(text.strip()) == 0:
|
| 10 |
+
return "Please enter some text."
|
| 11 |
+
summary = summarizer(text, max_length=200, min_length=60, do_sample=False)
|
| 12 |
+
return summary[0]['summary_text']
|
| 13 |
+
|
| 14 |
+
# واجهة المستخدم
|
| 15 |
+
iface = gr.Interface(
|
| 16 |
+
fn=summarize,
|
| 17 |
+
inputs=gr.Textbox(lines=10, label="Enter Physiotherapy Research Text"),
|
| 18 |
+
outputs=gr.Textbox(lines=10, label="Summarized Version"),
|
| 19 |
+
title="AI Physiotherapy Research Summarizer",
|
| 20 |
+
description="Paste any physiotherapy research abstract or article, and get a clear, concise summary.",
|
| 21 |
+
)
|
| 22 |
+
|
| 23 |
+
iface.launch()
|