| import gradio as gr | |
| import torch | |
| import pipeline | |
| from transformers import pipeline | |
| pipe = pipeline( | |
| task='onnx-base', | |
| model='m3/onnx-base', | |
| batch_size=10, | |
| device='cpu', | |
| ) | |
| def zero(name): | |
| input = torch.tensor([[1, 2], [3, 4]], dtype=torch.float32).numpy() | |
| result = pipe(input) | |
| return str(result) | |
| demo = gr.Interface(fn=zero, inputs="text", outputs="text") | |
| demo.launch() |