Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -37,14 +37,26 @@ def predict_sport_class(sentence):
|
|
| 37 |
predicted_class = label_mapping[predicted_label]
|
| 38 |
return predicted_class
|
| 39 |
|
| 40 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
interface = gr.Interface(
|
| 42 |
fn=predict_sport_class,
|
| 43 |
-
inputs=gr.Textbox(lines=2, placeholder="Enter
|
| 44 |
outputs=gr.Label(num_top_classes=1),
|
| 45 |
-
title="
|
| 46 |
-
description="Enter a
|
|
|
|
|
|
|
| 47 |
)
|
| 48 |
|
| 49 |
-
interface
|
|
|
|
| 50 |
|
|
|
|
| 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."],
|
| 44 |
+
["The prime minister announced new economic reforms."],
|
| 45 |
+
["The latest smartphone has cutting-edge features."],
|
| 46 |
+
["The actor delivered a stellar performance in the new movie."],
|
| 47 |
+
]
|
| 48 |
+
|
| 49 |
+
# Interface with examples and custom theme
|
| 50 |
interface = gr.Interface(
|
| 51 |
fn=predict_sport_class,
|
| 52 |
+
inputs=gr.Textbox(lines=2, placeholder="Enter Article here..."),
|
| 53 |
outputs=gr.Label(num_top_classes=1),
|
| 54 |
+
title="Topic Classification App",
|
| 55 |
+
description="Enter a topic to classify it into one of the following categories: sport, business, politics, tech, entertainment.",
|
| 56 |
+
examples=examples,
|
| 57 |
+
theme="compact", # Optional: You can pick other Gradio themes like "dark" or "soft"
|
| 58 |
)
|
| 59 |
|
| 60 |
+
# Customize the interface style
|
| 61 |
+
interface.launch(share=True, bg_color="#3b5998")
|
| 62 |
|