Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -31,12 +31,70 @@ def query_summarization(input_text):
|
|
| 31 |
# Create Gradio interface for text summarization
|
| 32 |
iface = gr.Interface(
|
| 33 |
fn=query_summarization, # Function to call
|
| 34 |
-
inputs=gr.Textbox(
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
description="Enter text to get a summarized version using Hugging Face's BART model.",
|
| 38 |
-
|
|
|
|
| 39 |
)
|
| 40 |
|
| 41 |
-
#
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
# Create Gradio interface for text summarization
|
| 32 |
iface = gr.Interface(
|
| 33 |
fn=query_summarization, # Function to call
|
| 34 |
+
inputs=gr.Textbox(
|
| 35 |
+
lines=10,
|
| 36 |
+
placeholder="Enter your text here...",
|
| 37 |
+
label="Input Text",
|
| 38 |
+
elem_id="input-text"
|
| 39 |
+
), # Input text area
|
| 40 |
+
outputs=gr.Textbox(
|
| 41 |
+
placeholder="Summary will appear here...",
|
| 42 |
+
label="Summary",
|
| 43 |
+
elem_id="summary-output"
|
| 44 |
+
), # Output summary text
|
| 45 |
+
title="AI Text Summarization",
|
| 46 |
description="Enter text to get a summarized version using Hugging Face's BART model.",
|
| 47 |
+
theme="huggingface", # Apply Hugging Face theme
|
| 48 |
+
live=True, # Set to True for live updates (optional)
|
| 49 |
)
|
| 50 |
|
| 51 |
+
# Custom CSS styling
|
| 52 |
+
css = """
|
| 53 |
+
#input-text {
|
| 54 |
+
font-size: 18px;
|
| 55 |
+
border: 2px solid #8a2be2;
|
| 56 |
+
border-radius: 10px;
|
| 57 |
+
padding: 15px;
|
| 58 |
+
width: 100%;
|
| 59 |
+
box-sizing: border-box;
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
#summary-output {
|
| 63 |
+
font-size: 18px;
|
| 64 |
+
border: 2px solid #8a2be2;
|
| 65 |
+
border-radius: 10px;
|
| 66 |
+
padding: 15px;
|
| 67 |
+
width: 100%;
|
| 68 |
+
box-sizing: border-box;
|
| 69 |
+
background-color: #f4f4f9;
|
| 70 |
+
color: #333;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
h1 {
|
| 74 |
+
text-align: center;
|
| 75 |
+
font-size: 3em;
|
| 76 |
+
color: #8a2be2;
|
| 77 |
+
margin-bottom: 30px;
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
.gradio-container {
|
| 81 |
+
background-color: #f5f5f5;
|
| 82 |
+
padding: 30px;
|
| 83 |
+
border-radius: 15px;
|
| 84 |
+
box-shadow: 0px 10px 20px rgba(0, 0, 0, 0.1);
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
.gradio-container .output-textbox {
|
| 88 |
+
font-family: "Arial", sans-serif;
|
| 89 |
+
color: #333;
|
| 90 |
+
font-size: 16px;
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
.gradio-container .input-textbox {
|
| 94 |
+
font-family: "Arial", sans-serif;
|
| 95 |
+
font-size: 16px;
|
| 96 |
+
}
|
| 97 |
+
"""
|
| 98 |
+
|
| 99 |
+
# Launch the interface with custom styling
|
| 100 |
+
iface.launch(share=True, css=css)
|