Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -37,6 +37,7 @@ def predict_sport_class(sentence):
|
|
| 37 |
predicted_class = label_mapping[predicted_label]
|
| 38 |
return predicted_class
|
| 39 |
|
|
|
|
| 40 |
examples = [
|
| 41 |
["The team won the championship in a thrilling match!"],
|
| 42 |
["The stock market saw a significant drop today."],
|
|
@@ -45,11 +46,48 @@ examples = [
|
|
| 45 |
["The actor delivered a stellar performance in the new movie."],
|
| 46 |
]
|
| 47 |
|
| 48 |
-
# Custom CSS for
|
| 49 |
custom_css = """
|
| 50 |
body {
|
| 51 |
-
background
|
| 52 |
-
color:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
}
|
| 54 |
"""
|
| 55 |
|
|
@@ -59,7 +97,7 @@ interface = gr.Interface(
|
|
| 59 |
inputs=gr.Textbox(lines=2, placeholder="Enter Article here..."),
|
| 60 |
outputs=gr.Label(num_top_classes=1),
|
| 61 |
title="Topic Classification App",
|
| 62 |
-
description="
|
| 63 |
examples=examples,
|
| 64 |
css=custom_css, # Apply custom CSS
|
| 65 |
)
|
|
|
|
| 37 |
predicted_class = label_mapping[predicted_label]
|
| 38 |
return predicted_class
|
| 39 |
|
| 40 |
+
# Define examples
|
| 41 |
examples = [
|
| 42 |
["The team won the championship in a thrilling match!"],
|
| 43 |
["The stock market saw a significant drop today."],
|
|
|
|
| 46 |
["The actor delivered a stellar performance in the new movie."],
|
| 47 |
]
|
| 48 |
|
| 49 |
+
# Custom CSS for a fascinating dark theme
|
| 50 |
custom_css = """
|
| 51 |
body {
|
| 52 |
+
background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460); /* Dark blue gradient */
|
| 53 |
+
color: #ff3e3e; /* Vibrant red text color */
|
| 54 |
+
font-family: 'Arial', sans-serif;
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
h1, h2, p {
|
| 58 |
+
color: #ff3e3e; /* Red for headings and descriptions */
|
| 59 |
+
text-shadow: 2px 2px 4px #000000; /* Text shadow for a glowing effect */
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
input[type="text"] {
|
| 63 |
+
background-color: #16213e; /* Dark input background */
|
| 64 |
+
color: #ffffff; /* White text in input fields */
|
| 65 |
+
border: 2px solid #0f3460; /* Blue border */
|
| 66 |
+
border-radius: 8px;
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
button {
|
| 70 |
+
background: linear-gradient(45deg, #ff3e3e, #0f3460); /* Gradient button */
|
| 71 |
+
color: #ffffff;
|
| 72 |
+
border: none;
|
| 73 |
+
border-radius: 8px;
|
| 74 |
+
padding: 10px 20px;
|
| 75 |
+
font-size: 16px;
|
| 76 |
+
cursor: pointer;
|
| 77 |
+
box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
|
| 78 |
+
transition: transform 0.2s;
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
button:hover {
|
| 82 |
+
transform: scale(1.05); /* Slight zoom effect on hover */
|
| 83 |
+
box-shadow: 2px 2px 15px rgba(255, 62, 62, 0.8);
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
.gradio-container {
|
| 87 |
+
border-radius: 15px;
|
| 88 |
+
padding: 20px;
|
| 89 |
+
background: rgba(0, 0, 0, 0.7); /* Transparent black background for the main container */
|
| 90 |
+
box-shadow: 0px 0px 15px #0f3460; /* Glowing effect for the container */
|
| 91 |
}
|
| 92 |
"""
|
| 93 |
|
|
|
|
| 97 |
inputs=gr.Textbox(lines=2, placeholder="Enter Article here..."),
|
| 98 |
outputs=gr.Label(num_top_classes=1),
|
| 99 |
title="Topic Classification App",
|
| 100 |
+
description="Classify topics into one of these categories: sport, business, politics, tech, entertainment.",
|
| 101 |
examples=examples,
|
| 102 |
css=custom_css, # Apply custom CSS
|
| 103 |
)
|