Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,8 +7,8 @@ classifier = pipeline("text-classification", model="sandbox338/hatespeech")
|
|
| 7 |
# Define the function for the interface
|
| 8 |
def classify_text(text):
|
| 9 |
results = classifier(text)
|
| 10 |
-
#
|
| 11 |
-
return
|
| 12 |
|
| 13 |
# Create the interface
|
| 14 |
interface = gr.Interface(
|
|
@@ -21,4 +21,4 @@ interface = gr.Interface(
|
|
| 21 |
|
| 22 |
# Launch the interface (only used if running locally)
|
| 23 |
if __name__ == "__main__":
|
| 24 |
-
interface.launch()
|
|
|
|
| 7 |
# Define the function for the interface
|
| 8 |
def classify_text(text):
|
| 9 |
results = classifier(text)
|
| 10 |
+
# Return only the label without the score
|
| 11 |
+
return results[0]['label']
|
| 12 |
|
| 13 |
# Create the interface
|
| 14 |
interface = gr.Interface(
|
|
|
|
| 21 |
|
| 22 |
# Launch the interface (only used if running locally)
|
| 23 |
if __name__ == "__main__":
|
| 24 |
+
interface.launch()
|