2,207,534 questions
1
vote
0
answers
17
views
How would I close a process (exe) gracefully on windows as if I was clicking the close button. In python
def close_apps():
for proc in psutil.process_iter(['name']):
if proc.info['name'] in kill_apps:
proc.kill()
elif proc.info['name'] in terminate_apps:
proc....
Advice
1
vote
1
replies
17
views
How to implement an efficient Human-in-the-loop workflow for AI-driven ERP risk analysis?
I am currently working on an AI-integrated ERP system that aims to achieve a "symbiotic" relationship between human decision-makers and AI models. Specifically, I am using Python (Pandas &...
Best practices
1
vote
2
replies
37
views
Standard name for key format passed to Python lists, tuples, etc
Python lists and tuples have a __getitem__that takes a very specific key format. The key is either an integer, a slice, an Ellipsis, or a tuple combination of these (maybe I forget one). In short, I'm ...
1
vote
1
answer
48
views
How to display real-time Vosk speech recognition text in Python GUI using Tkinter?
I am using the Vosk speech recognition library in Python to recognize speech
from a microphone in real time.
The recognition works correctly and I can print the result in the terminal.
However, I want ...
0
votes
0
answers
19
views
How to efficiently define an objective function in Optuna for CTGAN when synthesizing mixed tabular data?
I am currently working on a project that synthesizes tabular data for an electromagnetic interference detection system. My dataset contains mixed data types: continuous variables (e.g., power ...
-1
votes
0
answers
39
views
FastAPI logout works but user gets logged in again after page refresh
I am implementing authentication in FastAPI using cookies for session management. I have a logout endpoint that deletes the authentication cookie. The logout request returns 200 OK and the frontend ...
Best practices
0
votes
0
replies
30
views
How to optimize real-time image restoration performance in a Flask-based Deepfake defense system?
I am developing a system that integrates "Source Verifiable" and "Content Decipherable" into a single service workflow. The system uses Robust Watermarking to ensure source ...
Best practices
0
votes
8
replies
66
views
remove items from a list based on multiple criteria, without skipping
i have multiple lists of a bunch of strings gathered indiscriminately. i want to remove any that are unsuitable based on various criteria.
import re
asdf = ["apple", "dreamy", &...
Advice
0
votes
4
replies
110
views
Why does Python have `hash(-1) == hash(-2) == -2`?
I'm not sure how to really motivate this question, but in playing around with integer hashes in Python (3.14.3, but I imagine this has been the case for many versions), I noticed that for almost any ...
Advice
0
votes
4
replies
58
views
Obtaining root access in Python without elevating the rest of the script
I have a small Python script that requires a list of physical disks (not partitions or volumes) and their respective capacities. I'm using the pyparted module to accomplish this:
readable_disks_dict = ...
Advice
0
votes
1
replies
66
views
Large weather dataset design
I need to do some processing and analysis on a large dataset of weather and hydrological data. The data I'm scraping from the host website is formatted like this:
site_1 = [
['1970-01-01 00:00', -1.40,...
Advice
0
votes
6
replies
86
views
Undo last pop() in a Python stack implementation
I'm implementing a simple stack in Python and I want to add the ability to undo the last pop() operation.
The behavior I want is something like this:
s.push(10)
s.push(20)
s.push(30)
s.pop() # ...
0
votes
0
answers
53
views
How to robustly intercept PyTorch GPU OOM in a Python subprocess and dynamically adjust batch_size within an autonomous AI Agent loop?
I am building an autonomous AI Agent (managing training workflows) that automatically generates PyTorch/OpenMMLab training scripts and executes them in a background subprocess.
One of the common ...
-1
votes
0
answers
57
views
CUDA Out of Memory (OOM) when fine-tuning MedGemma-9B with QLoRA on a single 24GB GPU [closed]
I am trying to fine-tune the MedGemma-9B model for a medical document auditing task. I am using a single RTX 4090 with 24GB of VRAM. However, I keep encountering a CUDA Out of Memory error right when ...
2
votes
0
answers
63
views
Why does Groq langchain model return 'tool use failed error'?
One of my Langchain tools returns the below error when the agent is invoked, and so the agent does not actually proceed after the program is run:
groq.BadRequestError: Error code: 400 - {'error': {'...