Spaces:
Running
Running
import modal | |
from smolagents import Tool | |
from transformers import pipeline | |
from .app import app | |
from .image import image | |
class InferencePipelineModalApp: | |
def forward(self, task: str, model_name: str, image): | |
try: | |
pipe = pipeline(task=task, model=model_name, device="cuda") | |
result = pipe(image) | |
return result | |
except Exception as e: | |
raise Exception(f"Error in inference pipeline: {e}. Please try again with a different model.") | |