Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,16 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
|
4 |
+
# Load your model
|
5 |
+
summarizer = pipeline("summarization", model="your-username/your-model-name")
|
6 |
+
|
7 |
+
# Define the summarization function
|
8 |
+
def summarize(text):
|
9 |
+
summary = summarizer(text, max_length=130, min_length=30, do_sample=False)
|
10 |
+
return summary[0]['summary_text']
|
11 |
+
|
12 |
+
# Set up the Gradio interface
|
13 |
+
iface = gr.Interface(fn=summarize, inputs="text", outputs="text", title="Text Summarizer")
|
14 |
+
|
15 |
+
if __name__ == "__main__":
|
16 |
+
iface.launch()
|