mirror of
https://github.com/gradio-app/gradio.git
synced 2025-03-31 12:20:26 +08:00
Accelerate-Tests
- speed up a test with a smaller model
This commit is contained in:
parent
75a4bb95cb
commit
4d9e3f4cda
@ -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)
|
||||
|
@ -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?",
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user