Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,11 +9,12 @@ def detect_text(text):
|
|
| 9 |
if not text.strip():
|
| 10 |
return {}
|
| 11 |
|
| 12 |
-
# Run the model on the input text
|
| 13 |
results = classifier(text)
|
| 14 |
|
| 15 |
-
#
|
| 16 |
-
|
|
|
|
|
|
|
| 17 |
|
| 18 |
class_intro_html = "<center><h2>Text Origin & LLM Attribution Detector</h2></center>"
|
| 19 |
|
|
|
|
| 9 |
if not text.strip():
|
| 10 |
return {}
|
| 11 |
|
|
|
|
| 12 |
results = classifier(text)
|
| 13 |
|
| 14 |
+
# Use [ 0 ] to extract the dictionary from the nested list
|
| 15 |
+
inner_results = results[ 0 ]
|
| 16 |
+
|
| 17 |
+
return {res['label']: res['score'] for res in inner_results}
|
| 18 |
|
| 19 |
class_intro_html = "<center><h2>Text Origin & LLM Attribution Detector</h2></center>"
|
| 20 |
|