Ранее мы уже говорили о том, как выполнить какой-либо код перед открытием интерактивной консоли.
Расскажу еще один способ! На самом деле, даже запустив интерпретатор в обычном режиме с выполнением скрипта из файла вы можете в любом месте активировать интерактивный режим. Или даже несколько по очереди. За это отвечает модуль code.
Как это может пригодиться?
🔸 Вам не хватает pdb и хочется больше "власти"
🔸 Нужно запросить у юзера данные в достаточно сложном виде. В этом случае можно попросить его создать что ему надо и сохранить в определённую переменную, с которой потом и работать.
🔸 Нужна изолированная среда для выполнения каких-либо действий.
🔸 Просто забавы ради😁
Запускается консоль очень просто
import code
ic = code.InteractiveConsole()
try:
ic.interact()
except SystemExit:
pass
Выход обратно на предыдущий уровень происходит как обычно, вызов функции exit() или клавиши Ctrl+D(Ctrl+Z для Windows).
Я набросал простой пример с некоторым функционалом
🔹 Меняются символы приглашения
🔹 В неймспейсы добавляются дополнительные объекты
🔹 Считается время, проведённое в интерактивном режиме
🔹 Скрипт просит юзера заполнить переменную и по выходу распечатывает её значение
Код здесь ↗️
Для запуска сохраните код в файл и запускайте как обычный скрипт.
python my_console.py
Для быстрого запуска можно сделать отдельный алиас
alias py="python3 /home/username/my_console.py"
#tricks#source
🇬🇧UK Artists Demand AI Transparency in Copyright Use
More than 400 British artists — including Elton John, Dua Lipa, Coldplay, and Paul McCartney — have signed an open letter urging Prime Minister Keir Starmer to support legislation that would mandate transparency in the use of copyrighted materials for AI training. The letter emphasizes that creative copyright is not just a legal tool but “the lifeblood of the creative industries,” underpinning both moral ownership and economic sustainability for millions.
#AI#Copyright#AITraining
Copyright Claims on AI Training Dismissed: A Case of Harm and Fair Use
A recent New York court decision has set a notable precedent in copyright disputes involving AI training. Judge Colleen McMahon dismissed a lawsuit against OpenAI from news outlets Raw Story and AlterNet, which alleged the unauthorized use of their content to train ChatGPT. The case was dismissed on the grounds that the plaintiffs could not sufficiently demonstrate harm. However, Judge McMahon allowed room for an amended complaint, though she expressed doubt over whether the outlets could establish a recognizable injury under current law.
OpenAI maintains that their model training practices align with fair use principles, as they rely on publicly accessible data and established legal precedents. Raw Story and AlterNet are evaluating options for amendment, emphasizing their confidence in addressing the court's concerns. The decision brings to light complex questions on fair use and copyright harm, particularly as AI tools continue to evolve and reshape content creation.
#Copyright#AITraining#FairUse#AIRegulation
🚀 AI TRENDS | Moore Threads Completes Rapid Adaptation of MTT S5000 GPU for MiniMax M2.7
Moore Threads has announced the successful completion of the Day-0 rapid adaptation of its flagship AI training and inference all-in-one GPU, the MTT S5000, for the new generation large model, MiniMax M2.7. According to Odaily, this achievement further demonstrates the capability of domestically produced full-feature GPUs to quickly respond to and support cutting-edge AI models.
#MooreThreads#MTTS5000#AItraining#GPU#MiniMaxM2.7 #AImodels#domesticGPU
The next layer of EdgeMarket is live.
We’re introducing community validation for real world events feeding verified truth directly into AI systems.
Every validation strengthens the network.
Every correct signal earns rewards.
⚡ Validate events
🧠. Train AI with real data
💰 Earn $BET
This is how decentralised intelligence is built.
Signal Truth. Earn $BET
Click Here ⬇️ To Start
https://edgemarket.ai/bnb/validate-results
#EdgeMarket#AI#Web3#Crypto#BET
#Airdrop#EarnCrypto#SignalTruth#Validation
#Decentralization#AITraining#Blockchain
#CommunityDriven#OnChain#DePIN