MCPcopy
hub / github.com/mudler/LocalAI / test

Method test

backend/python/diffusers/test.py:76–95  ·  view source on GitHub ↗

This method tests if the backend can generate images

(self)

Source from the content-addressed store, hash-verified

74 self.tearDown()
75
76 def test(self):
77 """
78 This method tests if the backend can generate images
79 """
80 time.sleep(20)
81 try:
82 self.setUp()
83 with grpc.insecure_channel("localhost:50051") as channel:
84 stub = backend_pb2_grpc.BackendStub(channel)
85 response = stub.LoadModel(backend_pb2.ModelOptions(Model="Lykon/dreamshaper-8"))
86 print(response.message)
87 self.assertTrue(response.success)
88 image_req = backend_pb2.GenerateImageRequest(positive_prompt="cat", width=16,height=16, dst="test.jpg")
89 re = stub.GenerateImage(image_req)
90 self.assertTrue(re.success)
91 except Exception as err:
92 print(err)
93 self.fail("Image gen service failed")
94 finally:
95 self.tearDown()
96
97
98class TestDiffusersDynamicLoader(unittest.TestCase):

Callers 15

pdf.min.jsFile · 0.80
constructorMethod · 0.80
textdecodeFunction · 0.80
fixupEncodingFunction · 0.80
rfc2047decodeFunction · 0.80
constructorMethod · 0.80
constructorMethod · 0.80
constructorMethod · 0.80
constructorMethod · 0.80
renderMethod · 0.80
codemirror.min.jsFile · 0.80

Calls 4

setUpMethod · 0.95
tearDownMethod · 0.95
LoadModelMethod · 0.65
GenerateImageMethod · 0.65

Tested by

no test coverage detected