Skip to main content

Posts

Avoid Telegram's file size limit

Telegram bots have a 20MB size limit for files, i was wondering if it was possible to avoid it in python, especially with the pyTelegramBotAPI module. I found a similar question here on stackoverflow but it wasn't using python. source https://stackoverflow.com/questions/70825763/avoid-telegrams-file-size-limit

Live time series with confidence intervals

Let us assume a loop like below: import numpy as np ax = []; ay = [] for n in range(N): avgC = np.zeros(M) for m in range(M): ... Cost = aFuncation avgC[m] = Cost ax.append(n); ay.append(np.mean(avgC)) I would like to use ax and ay to plot a live time series which shows how np.mean(avgC) evolves over different iterations of n . At the same time, I would like to plot the confidence intervals according to avgC (a figure like below example). source https://stackoverflow.com/questions/70825697/live-time-series-with-confidence-intervals

NLP model for binary classification outputs a class for each word

I am basically running the code from Francois Chollet's Deep learning with python chapter 11. It is a binary sentiment classification. For each sentence the label is 0 or 1. After running the model as in the book, I try to make a prediction on one of the "validation" sentences. The full code is a public kaggle notebook that can be found here: https://www.kaggle.com/louisbunuel/deep-learning-with-python It is part of the notebook here: https://github.com/fchollet/deep-learning-with-python-notebooks/blob/master/chapter11_part02_sequence-models.ipynb the only thing I added is my "extraction" of a tokenized sentence from the tokenized tensorflow dataset so that I can see an example of an output. I was expecting a number from 0 to 1 (a probability indeed) but instead I get an array of numbers from 0 to 1, one for each word in the sentence. In other words, it looks as if the model does not assign labels to each sentence but to each word. Can anybody explain me what...

How to make the parent widget not adjust to the child?

I want the child widget to just appear in the center of the parent widget with a horizontal pink stripe. But the widget of the parent becomes very small from PySide6 import QtWidgets, QtGui import sys class WidgetA(QtWidgets.QWidget): def __init__(self): super(WidgetA, self).__init__() self.wb = WidgetB() vbox = QtWidgets.QVBoxLayout() hbox = QtWidgets.QHBoxLayout() hbox.addWidget(self.wb) vbox.addLayout(hbox) self.setLayout(vbox) class WidgetB(QtWidgets.QWidget): def __init__(self): super(WidgetB, self).__init__() palette = self.palette() palette.setColor(QtGui.QPalette.Window, QtGui.QColor("#ff00ff")) self.setPalette(palette) app = QtWidgets.QApplication() window = WidgetA() window.show() sys.exit(app.exec()) If I have not written something, or something is not clear in my question, then ask, I will supplement it source https://stackoverflow.com/questions/70825736/how-...

How do I make a local database for my python flask web app [closed]

I'm just starting to do projects on python and I'm using the flask framework and I'm somewhat stuck on the database code wherein I need to build a database and migrate things. Is there easier way to do it like migrating things in laravel? and I'm using windows by the way source https://stackoverflow.com/questions/70825570/how-do-i-make-a-local-database-for-my-python-flask-web-app

raspberry pi python 3 update and upgrading error cant update anything

imtrying to update my raspberry pi 3b but i get this error.i can not update anythingt because of this error. File "usr/bin/pip3", line 5, in from pkg_resouces import load_entry_point File"usr/local/lib/python3.4/dist-packages/pkg_recourses/ init .py", line 117 f"{v} is an invalid version and will not be supported in " ^ SyntaxError: invalid syntax source https://stackoverflow.com/questions/70816775/raspberry-pi-python-3-update-and-upgrading-error-cant-update-anything

Call MongoDB stored function from pymongo

I have the following function stored in mongodb: db.system.js.save({ _id: "testFunc", value: function() { return db.clients.find_one({}, {"_id" : False}); } }); How do I call the function above from python using pymongo? I have already tried db.eval('testFunc') and it doesn't work. The method is deprecated. Via Active questions tagged javascript - Stack Overflow https://ift.tt/2FdjaAW