Closed sinuso closed 8 months ago
Seems phind isn't working anymore.
Try out this:
pytgpt generate "Visualize the disk usage using pie chart" -rd -p Aura -n -int python3
Seems phind isn't working anymore.
Try out this:
pytgpt generate "Visualize the disk usage using pie chart" -rd -p Aura -n -int python3
@Simatwa The results in Linux and Windows.
Result on Linux:
:~$ pytgpt generate "Visualize the disk usage using pie chart" -rd -p Aura -n -int python3
To get the most out of Rawdog. Ensure the following are installed:
1. Python interpreter.
2. Dependency:
- Matplotlib
Be alerted on the risk posed! (Experimental)
Use '--quiet' to suppress this message and code/logs stdout.
import os
import sys
import subprocess
import matplotlib.pyplot as plt
def get_disk_usage():
usage = {}
for root, dirs, files in os.walk('/'):
path = os.path.normpath(root)
if path.startswith('/boot') or path.startswith('/proc') or path.startswith('/sys') or path.startswith('/dev'):
continue
if path.startswith('/home/ubuntu'):
path = '/home/ubuntu'
else:
path = '/'
stats = os.statvfs(path)
size = stats.f_blocks * stats.f_frsize
usage[path] = size
return usage
def plot_disk_usage(usage):
labels = list(usage.keys())
sizes = list(usage.values())
plt.figure(figsize=(10, 10))
plt.pie(sizes, labels=labels, autopct='%1.1f%%', startangle=140)
plt.axis('equal')
plt.show()
if __name__ == "__main__":
usage = get_disk_usage()
plot_disk_usage(usage)
10:12:53 - INFO : [PYTGPT] - Executing script externally
10:13:14 - INFO : [PYTGPT] - Returning success feedback
import os
import sys
import subprocess
import matplotlib.pyplot as plt
def get_disk_usage():
usage = {}
for root, dirs, files in os.walk('/'):
path = os.path.normpath(root)
if path.startswith('/boot') or path.startswith('/proc') or path.startswith('/sys') or path.startswith('/dev'):
continue
if path.startswith('/home/ubuntu'):
path = '/home/ubuntu'
else:
path = '/'
stats = os.statvfs(path)
size = stats.f_blocks * stats.f_frsize
usage[path] = size
return usage
def plot_disk_usage(usage):
labels = list(usage.keys())
sizes = list(usage.values())
plt.figure(figsize=(10, 10))
plt.pie(sizes, labels=labels, autopct='%1.1f%%', startangle=140)
plt.axis('equal')
plt.show()
if __name__ == "__main__":
usage = get_disk_usage()
plot_disk_usage(usage)
10:13:36 - INFO : [PYTGPT] - Executing script externally
10:13:41 - INFO : [PYTGPT] - Returning success feedback
import os
import sys
import subprocess
import matplotlib.pyplot as plt
def get_disk_usage():
usage = {}
for root, dirs, files in os.walk('/'):
path = os.path.normpath(root)
if path.startswith('/boot') or path.startswith('/proc') or path.startswith('/sys') or path.startswith('/dev'):
continue
if path.startswith('/home/ubuntu'):
path = '/home/ubuntu'
else:
path = '/'
stats = os.statvfs(path)
size = stats.f_blocks * stats.f_frsize
usage[path] = size
return usage
def plot_disk_usage(usage):
labels = list(usage.keys())
sizes = list(usage.values())
plt.figure(figsize=(10, 10))
plt.pie(sizes, labels=labels, autopct='%1.1f%%', startangle=140)
plt.axis('equal')
plt.show()
if __name__ == "__main__":
usage = get_disk_usage()
plot_disk_usage(usage)
10:14:03 - INFO : [PYTGPT] - Executing script externally
10:14:07 - INFO : [PYTGPT] - Returning success feedback
import os
import sys
import subprocess
import matplotlib.pyplot as plt
def get_disk_usage():
usage = {}
for root, dirs, files in os.walk('/'):
path = os.path.normpath(root)
if path.startswith('/boot') or path.startswith('/proc') or path.startswith('/sys') or path.startswith('/dev'):
continue
if path.startswith('/home/ubuntu'):
path = '/home/ubuntu'
else:
path = '/'
stats = os.statvfs(path)
size = stats.f_blocks * stats.f_frsize
usage[path] = size
return usage
def plot_disk_usage(usage):
labels = list(usage.keys())
sizes = list(usage.values())
plt.figure(figsize=(10, 10))
plt.pie(sizes, labels=labels, autopct='%1.1f%%', startangle=140)
plt.axis('equal')
plt.show()
if __name__ == "__main__":
usage = get_disk_usage()
plot_disk_usage(usage)
10:14:27 - INFO : [PYTGPT] - Executing script externally
10:14:31 - INFO : [PYTGPT] - Returning success feedback
import os
import sys
import subprocess
import matplotlib.pyplot as plt
def get_disk_usage():
usage = {}
for root, dirs, files in os.walk('/'):
path = os.path.normpath(root)
if path.startswith('/boot') or path.startswith('/proc') or path.startswith('/sys') or path.startswith('/dev'):
continue
if path.startswith('/home/ubuntu'):
path = '/home/ubuntu'
else:
path = '/'
stats = os.statvfs(path)
size = stats.f_blocks * stats.f_frsize
usage[path] = size
return usage
def plot_disk_usage(usage):
labels = list(usage.keys())
sizes = list(usage.values())
plt.figure(figsize=(10, 10))
plt.pie(sizes, labels=labels, autopct='%1.1f%%', startangle=140)
plt.axis('equal')
plt.show()
if __name__ == "__main__":
usage = get_disk_usage()
plot_disk_usage(usage)
10:14:51 - INFO : [PYTGPT] - Executing script externally
10:14:55 - INFO : [PYTGPT] - Returning success feedback
User : LAST SCRIPT OUTPUT:
LLM : LLM :
Result on Windows:
>pytgpt generate "Visualize the disk usage using pie chart" -rd -p Aura -n -int python3
To get the most out of Rawdog. Ensure the following are installed:
1. Python interpreter.
2. Dependency:
- Matplotlib
Be alerted on the risk posed! (Experimental)
Use '--quiet' to suppress this message and code/logs stdout.
import os
import platform
import subprocess
import matplotlib.pyplot as plt
os.makedirs("disk_usage", exist_ok=True)
def get_disk_usage(path):
usage = 0
total = 0
for root, dirs, files in os.walk(path):
for f in files:
fp = os.path.join(root, f)
if not os.path.islink(fp):
usage += os.path.getsize(fp)
total += usage
usage = 0
return total
def plot_pie_chart(labels, sizes):
plt.figure(figsize=(10, 6))
plt.pie(sizes, labels=labels, autopct='%1.1f%%', startangle=140)
plt.axis('equal')
plt.savefig("disk_usage/pie_chart.png")
plt.close()
def main():
system = platform.system()
if system != "Windows":
print("Sorry, this script is only designed to work on Windows.")
return
total_usage = get_disk_usage("C:\\")
drives = ["C:"]
drive_usage = {}
for drive in drives:
drive_usage[drive] = get_disk_usage(drive) / total_usage * 100
labels = ["C:"]
sizes = [drive_usage["C:"]]
plot_pie_chart(labels, sizes)
if __name__ == "__main__":
main()
11:14:06 - INFO : [PYTGPT] - Executing script externally
Traceback (most recent call last):
File "C:\Users\Test\AppData\Local\Smartwa\pytgpt\Cache\execute_this.py", line 5, in <module>
import matplotlib.pyplot as plt
ModuleNotFoundError: No module named 'matplotlib'
In windows:
pip install matplotlib
In windows:
pip install matplotlib
I have installed it, but the error repeats or it shows me an error for some other package.
Perhaps you're having a broken environment or multiple python versions conflicting each other, which is somehow not directly related to python-tgpt. Otherwise thanks for sharing this concern fork.
Seems phind isn't working anymore.
Try out this:
pytgpt generate "Visualize the disk usage using pie chart" -rd -p Aura -n -int python3
I use below command in Windows to get fastest working provider.
python -c "import urllib.request; exec(urllib.request.urlopen('https://raw.githubusercontent.com/ayoub-fork/g4f-check/main/g4fcheck.py').read())"
====== WORKING PROVIDERS ======
Aura 1.04s
You 1.48s
Phind 2.15s
Liaobots 2.44s
Bing 4.96s
Koala 6.14s
ChatBase 10.26s
====== FASTEST PROVIDER ======
Aura 1.04s
====== 7/88 WORKING ======
it is possible to have this in pytgpt
to avoid checking which provider is working or not at a given point of time. or list with speed of each providers
by default we can choose fastest provider
we may allow user to chose model but if not provided with -p
we may chose fastest provider or next to fastest provider or from the working providers from g4f
LGTM.
I will be introducing dynamic provider named g4fauto
which denotes the fastest provider of them all.
On both systems I use python3.X
Result on Linux:
Result on Windows: