def setImage1(self): try: # HOST = '192.168.43.217' PORT = 6666 c = s.connect_tcp(HOST,PORT) print("client connected on socket ", c) s.send_text("hotel1", c) data1 = s.rcv_data(c) myfile1 = open("recievedPic.jpg", 'wb') myfile1.write(data1) pixmap = QPixmap("recievedPic.jpg") self.ui.label_8.setPixmap(pixmap) except: self.errorMessage1()
def setVideo2(self): try: # HOST = '192.168.43.217' PORT = 6666 c = s.connect_tcp(HOST,PORT) #print("client connected on socket ", c) s.send_text("hotel2video", c) data1 = s.rcv_data(c) myfile1 = open("recievedVideo.mp4", 'wb') myfile1.write(data1) #print(url) print("I'm here") self.ui.tabWidget.setTabEnabled(2, True) self.ui.tabWidget.setCurrentIndex(2) #self.errorMessage() except: self.errorMessage1()
def Book(self): # HOST = '192.168.43.217' PORT = 6666 data = [] data.append(self.ui.lineEdit_3.text()) data.append(self.ui.lineEdit_2.text()) data.append(self.ui.lineEdit_4.text()) data.append(self.ui.lineEdit_5.text()) data.append("save") for x in data: c = s.connect_tcp(HOST,PORT) #print("client connected on socket ", c) s.send_text(x, c) self.bookedMessage() self.ui.tabWidget.setCurrentIndex(0) self.ui.tabWidget.setTabEnabled(1, False) self.ui.tabWidget.setTabEnabled(2, False) self.ui.tabWidget.setTabEnabled(3, False)
import easySocket as s HOST = '127.0.0.1' PORT = 6666 c = s.connect_tcp(HOST,PORT) print("client connected on socket ", c) s.send_text("hotel2", c) data = s.rcv_data(c) myfile = open("hotel2r.jpg", 'wb') myfile.write(data)
def make(i): ymin, xmin, ymax, xmax = boxes[i] return Object(id=int(class_ids[i]), score=scores[i], bbox=BBox(xmin=np.maximum(0.0, xmin), ymin=np.maximum(0.0, ymin), xmax=np.minimum(1.0, xmax), ymax=np.minimum(1.0, ymax))) top_k = min(top_k, len(scores)) return [make(i) for i in range(top_k) if scores[i] >= score_threshold] import asyncio import easySocket s = easySocket.connect_tcp("147.47.200.64", 38000) async def saving(pil_im, class_names, scores, boxes, images_dir, predictions_dir, nodetection_images_dir): # save the detection results start_time = time.monotonic() if len(class_names) > 0: # save the image file t = datetime.datetime.now().strftime("%Y%m%d_%H%M%S_%f") image_name = t + ".jpg" image_path = os.path.join(images_dir, image_name) pil_im.save(image_path) # send image file to server easySocket.send_text('image', s) easySocket.send_text(image_name, s)