Spaces:
Sleeping
Sleeping
dixiebone13-a11y commited on
Commit ·
1d10c02
1
Parent(s): 70e9094
Fix: Remove dataclass with Dict type to avoid Gradio schema bug
Browse files- app.py +8 -8
- requirements.txt +1 -1
app.py
CHANGED
|
@@ -17,8 +17,7 @@ os.environ['GRADIO_ALLOW_FLAGGING'] = 'never'
|
|
| 17 |
import gradio as gr
|
| 18 |
import torch
|
| 19 |
import numpy as np
|
| 20 |
-
from
|
| 21 |
-
from typing import Dict, List, Tuple
|
| 22 |
import time
|
| 23 |
import spaces
|
| 24 |
|
|
@@ -38,13 +37,14 @@ CONSCIOUS_DIMS_V2_1 = {
|
|
| 38 |
4578: {"name": "Abstraction", "weight": 0.109, "polarity": +1},
|
| 39 |
}
|
| 40 |
|
| 41 |
-
@dataclass
|
| 42 |
class ConsciousnessResult:
|
| 43 |
-
|
| 44 |
-
raw_score
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
|
|
|
|
|
|
| 48 |
|
| 49 |
|
| 50 |
def compute_consciousness(
|
|
|
|
| 17 |
import gradio as gr
|
| 18 |
import torch
|
| 19 |
import numpy as np
|
| 20 |
+
from typing import Tuple
|
|
|
|
| 21 |
import time
|
| 22 |
import spaces
|
| 23 |
|
|
|
|
| 37 |
4578: {"name": "Abstraction", "weight": 0.109, "polarity": +1},
|
| 38 |
}
|
| 39 |
|
|
|
|
| 40 |
class ConsciousnessResult:
|
| 41 |
+
"""Simple result container without dataclass to avoid Gradio schema issues."""
|
| 42 |
+
def __init__(self, score, raw_score, dimension_contributions, interpretation, processing_time):
|
| 43 |
+
self.score = score
|
| 44 |
+
self.raw_score = raw_score
|
| 45 |
+
self.dimension_contributions = dimension_contributions
|
| 46 |
+
self.interpretation = interpretation
|
| 47 |
+
self.processing_time = processing_time
|
| 48 |
|
| 49 |
|
| 50 |
def compute_consciousness(
|
requirements.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
gradio==4.
|
| 2 |
transformers>=4.40.0
|
| 3 |
torch>=2.0.0
|
| 4 |
accelerate>=0.28.0
|
|
|
|
| 1 |
+
gradio==4.44.0
|
| 2 |
transformers>=4.40.0
|
| 3 |
torch>=2.0.0
|
| 4 |
accelerate>=0.28.0
|