Accelerate-Tests

- speed up a test with a smaller model
This commit is contained in:
Ömer Faruk Özdemir 2022-02-09 09:38:40 +03:00
parent 75a4bb95cb
commit 4d9e3f4cda
2 changed files with 8 additions and 3 deletions

View File

@ -94,6 +94,12 @@ class Interface:
pipeline (transformers.Pipeline):
Returns:
(gradio.Interface): a Gradio Interface object from the given Pipeline
Example usage:
import gradio as gr
from transformers import pipeline
pipe = pipeline(model="lysandre/tiny-vit-random")
gr.Interface.from_pipeline(pipe).launch()
"""
interface_info = load_from_pipeline(pipeline)
kwargs = dict(interface_info, **kwargs)

View File

@ -244,9 +244,8 @@ class TestLoadInterface(unittest.TestCase):
class TestLoadFromPipeline(unittest.TestCase):
def test_question_answering(self):
p = transformers.pipeline("question-answering")
io = gr.Interface.from_pipeline(p)
output = io(
pipe = transformers.pipeline(model="lysandre/tiny-vit-random")
output = pipe(
"My name is Sylvain and I work at Hugging Face in Brooklyn",
"Where do I work?",
)