Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -282,6 +282,16 @@ def score_video_safe(video):
|
|
| 282 |
return f"Error: {e}\n{traceback.format_exc()}", ""
|
| 283 |
|
| 284 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 285 |
def score_text_safe(text):
|
| 286 |
if not text or not text.strip(): return "Enter text.", ""
|
| 287 |
try:
|
|
@@ -323,9 +333,11 @@ with gr.Blocks(title="TRIBE V2 Brain Prediction", theme=gr.themes.Base(
|
|
| 323 |
with gr.Tab("📝 Text"):
|
| 324 |
t_in = gr.Textbox(label="Content", lines=5, placeholder="Paste script or hook...")
|
| 325 |
t_btn = gr.Button("🧠 Analyze", variant="primary")
|
| 326 |
-
|
|
|
|
|
|
|
| 327 |
t_ins = gr.Textbox(label="💡 Insight")
|
| 328 |
-
t_btn.click(
|
| 329 |
|
| 330 |
with gr.Tab("🎬 Video"):
|
| 331 |
gr.Markdown("Upload a video — audio is transcribed and scored. ~30-60s on GPU.")
|
|
|
|
| 282 |
return f"Error: {e}\n{traceback.format_exc()}", ""
|
| 283 |
|
| 284 |
|
| 285 |
+
def score_text_with_chart(text):
|
| 286 |
+
if not text or not text.strip(): return "Enter text.", None, ""
|
| 287 |
+
try:
|
| 288 |
+
s = _predict(text.strip())
|
| 289 |
+
return _fmt(s), _radar(s), _insight(s)
|
| 290 |
+
except Exception as e:
|
| 291 |
+
import traceback
|
| 292 |
+
return f"Error: {e}\n{traceback.format_exc()}", None, ""
|
| 293 |
+
|
| 294 |
+
|
| 295 |
def score_text_safe(text):
|
| 296 |
if not text or not text.strip(): return "Enter text.", ""
|
| 297 |
try:
|
|
|
|
| 333 |
with gr.Tab("📝 Text"):
|
| 334 |
t_in = gr.Textbox(label="Content", lines=5, placeholder="Paste script or hook...")
|
| 335 |
t_btn = gr.Button("🧠 Analyze", variant="primary")
|
| 336 |
+
with gr.Row():
|
| 337 |
+
t_out = gr.Textbox(label="Scores", lines=10)
|
| 338 |
+
t_img = gr.Image(label="Brain Radar", type="filepath")
|
| 339 |
t_ins = gr.Textbox(label="💡 Insight")
|
| 340 |
+
t_btn.click(score_text_with_chart, [t_in], [t_out, t_img, t_ins], api_name="predict")
|
| 341 |
|
| 342 |
with gr.Tab("🎬 Video"):
|
| 343 |
gr.Markdown("Upload a video — audio is transcribed and scored. ~30-60s on GPU.")
|