(self, module, file_target=None)
| 40 | cleanup() |
| 41 | |
| 42 | def warp_into_web(self, module, file_target=None): |
| 43 | client = None |
| 44 | for _ in range(5): |
| 45 | try: |
| 46 | port = random.randint(10000, 30000) |
| 47 | web = lazyllm.WebModule(module, port=port, files_target=file_target) |
| 48 | web._work() |
| 49 | time.sleep(2) |
| 50 | except AssertionError as e: |
| 51 | # Port is occupied |
| 52 | if 'occupied' in e: |
| 53 | continue |
| 54 | else: |
| 55 | raise e |
| 56 | try: |
| 57 | client = Client(web.url, download_files=web.cach_path) |
| 58 | break |
| 59 | except httpx.ConnectError: |
| 60 | continue |
| 61 | assert client, 'Unable to create client' |
| 62 | self.webs.append(web) |
| 63 | self.clients.append(client) |
| 64 | return web, client |
| 65 | |
| 66 | def test_chat(self): |
| 67 | from examples.chatbot_online import chat |
no test coverage detected