Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from cear_model import CEARModel
|
| 3 |
import pandas as pd
|
|
|
|
| 4 |
|
| 5 |
# Initialize Model
|
| 6 |
cear_analyzer = CEARModel()
|
|
@@ -18,7 +19,7 @@ DEFAULT_DATA = [
|
|
| 18 |
|
| 19 |
def interpret_scores(c_score, a_risk, d_index):
|
| 20 |
"""
|
| 21 |
-
Converts raw numbers into human-readable context.
|
| 22 |
"""
|
| 23 |
# --- 1. Interpret Algorithmic Risk (A-Risk) ---
|
| 24 |
# Thresholds: <150 (Low), 150-500 (Medium), >500 (High)
|
|
@@ -91,14 +92,15 @@ def analyze_user_data(input_table, variety_rating, fomo_rating):
|
|
| 91 |
|
| 92 |
---
|
| 93 |
### 🗣️ Self-Reported Context
|
| 94 |
-
* **Variety:** {variety_rating}/5
|
| 95 |
-
* **FOMO:** {fomo_rating}/5
|
| 96 |
"""
|
| 97 |
|
| 98 |
return summary, pd.DataFrame(raw_scores['Per_Platform_Efficiency'])
|
| 99 |
|
| 100 |
-
# --- Interface Definition ---
|
| 101 |
-
|
|
|
|
| 102 |
gr.Markdown("# 🧭 Cultural Exposure & Algorithmic Risk (CEAR) Model")
|
| 103 |
gr.Markdown("""
|
| 104 |
**Instructions:**
|
|
@@ -136,4 +138,4 @@ with gr.Blocks(title="CEAR Model", theme=gr.themes.Soft()) as demo:
|
|
| 136 |
)
|
| 137 |
|
| 138 |
if __name__ == "__main__":
|
| 139 |
-
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from cear_model import CEARModel
|
| 3 |
import pandas as pd
|
| 4 |
+
import numpy as np # Used for consistency, though cear_model uses it
|
| 5 |
|
| 6 |
# Initialize Model
|
| 7 |
cear_analyzer = CEARModel()
|
|
|
|
| 19 |
|
| 20 |
def interpret_scores(c_score, a_risk, d_index):
|
| 21 |
"""
|
| 22 |
+
Converts raw numbers into human-readable context with thresholds.
|
| 23 |
"""
|
| 24 |
# --- 1. Interpret Algorithmic Risk (A-Risk) ---
|
| 25 |
# Thresholds: <150 (Low), 150-500 (Medium), >500 (High)
|
|
|
|
| 92 |
|
| 93 |
---
|
| 94 |
### 🗣️ Self-Reported Context
|
| 95 |
+
* **Perceived Variety:** {variety_rating}/5
|
| 96 |
+
* **FOMO Intensity:** {fomo_rating}/5
|
| 97 |
"""
|
| 98 |
|
| 99 |
return summary, pd.DataFrame(raw_scores['Per_Platform_Efficiency'])
|
| 100 |
|
| 101 |
+
# --- Interface Definition (FIXED: theme removed) ---
|
| 102 |
+
# Removed: theme=gr.themes.Soft()
|
| 103 |
+
with gr.Blocks(title="CEAR Model") as demo:
|
| 104 |
gr.Markdown("# 🧭 Cultural Exposure & Algorithmic Risk (CEAR) Model")
|
| 105 |
gr.Markdown("""
|
| 106 |
**Instructions:**
|
|
|
|
| 138 |
)
|
| 139 |
|
| 140 |
if __name__ == "__main__":
|
| 141 |
+
demo.launch(server_name="0.0.0.0", server_port=7860)
|