Update app.py
Browse files
app.py
CHANGED
|
@@ -14,15 +14,8 @@ def zeroShotClassification(text_input, candidate_labels):
|
|
| 14 |
# For Label component: Return raw scores (not percentage strings)
|
| 15 |
results = {label: score for label, score in zip(prediction['labels'], prediction['scores'])}
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
for label, score in sorted(results.items(), key=lambda x: x[1], reverse=True):
|
| 20 |
-
# Convert to percentage for display
|
| 21 |
-
percentage = score * 100
|
| 22 |
-
blocks = "█" * int(percentage/5) + "░" * (20 - int(percentage/5))
|
| 23 |
-
markdown_output += f"**{label}**: {blocks} {percentage:.2f}%\n\n"
|
| 24 |
-
|
| 25 |
-
return results, markdown_output
|
| 26 |
|
| 27 |
# Create the interface
|
| 28 |
demo = gr.Interface(
|
|
|
|
| 14 |
# For Label component: Return raw scores (not percentage strings)
|
| 15 |
results = {label: score for label, score in zip(prediction['labels'], prediction['scores'])}
|
| 16 |
|
| 17 |
+
|
| 18 |
+
return results, ''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
# Create the interface
|
| 21 |
demo = gr.Interface(
|