Fetching metadata from the HF Docker repository...
-
Update app.py
-
Update app.py
-
Update requirements.txt
-
Update app.py
-
Update requirements.txt
-
app.py
-
app.py
import gradio as gr
import torch
from pathlib import Path
import tempfile
import os
from PIL import Image
import matplotlib.pyplot as plt
from nilearn import plotting as nilearn_plot
from tribev2 import TribeModel
# Setup
CACHE_FOLDER = Path("./cache")
os.makedirs(CACHE_FOLDER, exist_ok=True)
print("Loading TRIBE v2-mini...")
try:
model = TribeModel.from_pretrained("facebook/tribev2-mini", cache_folder=CACHE_FOLDER)
except Exception as e:
print(f"Model load error: {e}")
def process_and_predict(media_file, media_type="auto", text_input=None, quick_mode=True):
with tempfile.TemporaryDirectory() as tmpdir:
tmp_path = Path(tmpdir)
# Simple input handling
if media_type == "text" or (media_type == "auto" and text_input):
text_path = tmp_path / "input.txt"
with open(text_path, "w", encoding="utf-8") as f:
f.write(text_input or "")
events_df = model.get_events_dataframe(text_path=str(text_path))
… -
Update app.py
-
requirements.txt
gradio>=5.0
torch
torchvision
torchaudio
pillow
matplotlib
nilearn
tribev2 @ git+https://github.com/facebookresearch/tribev2.git -
initial commit