MetaLM工具集
Project description
MetaLM-tools
metalm的工具集,当前只有代码解释器这一个工具。
案例:
from metalm_tools import MetaLMInterpreterTool
import time
import json
packages=['numpy','pandas']
#画图
c = """
import matplotlib.pyplot as plt
import time
# 数据
x = [1, 2, 3, 4, 5]
y = [1, 4, 9, 16, 25]
# 创建折线图
plt.plot(x, y, marker='o')
# 添加标题和轴标签
plt.title("Simple Line Plot")
plt.xlabel("X Axis")
plt.ylabel("Y Axis")
# 显示图形
plt.grid(True) # 显示网格线
plt.show()
plt.savefig('test1.png')
x = [1, 2, 3, 4, 5]
y = [1, 4, 9, 16, 25]
# 创建折线图
plt.plot(x, y, marker='o')
# 添加标题和轴标签
plt.title("Simple Line Plot")
plt.xlabel("X Axis")
plt.ylabel("Y Axis")
# 显示图形
plt.grid(True) # 显示网格线
plt.show()
plt.savefig('test2.png')
for i in x:
print(i)
time.sleep(1)
"""
#操作csv
c2 = """
import pandas as pd
# 读取CSV文件
df = pd.read_csv('/codebox/1.csv')
# 获取前5行
df_first_five = df.head(5)
# 保存前5行到新的CSV文件
df_first_five.to_csv('output_file.csv', index=False)
print("前5行已保存到 'output_file.csv'")
"""
tool = MetaLMInterpreterTool('http://10.88.36.58:5002','empty')
print(tool.session.session_id)
tool.install_python_packages(packages)
res1 = tool.upload_files(['/data/jueyuan/project/test/1.csv'],['这是要分析的数据'])
res2 = tool.upload_files(['/data/jueyuan/project/test/image.png'],['这是图片'])
print('path:',res1,res2)
rsp = tool._run(c2)
rsp = json.loads(rsp)
print(rsp)
tbyte = tool.download_files(['output_file.csv'])
print(tbyte)
rsp = tool._run(c)
rsp = json.loads(rsp)
print(rsp)
tool.close()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
metalm_tools-0.1.0.tar.gz
(12.0 kB
view details)
Built Distribution
File details
Details for the file metalm_tools-0.1.0.tar.gz
.
File metadata
- Download URL: metalm_tools-0.1.0.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a786a67e71c2ffc3db760762ac7243c19ff0e876697c129356418488ee38c74 |
|
MD5 | b88ff5c6e11dfc3132cbb9f020d08f09 |
|
BLAKE2b-256 | da4aafcec9dc4dd68cf8a21d66e42455d6aa47c9f1a9677fce09e064b2516e34 |
File details
Details for the file metalm_tools-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: metalm_tools-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d352d834bb97dcfd67b70a2f549a3e8e9f4c61609f04c80fdbb22d1242fbd67c |
|
MD5 | 3f26d2607dc84e0ec06eb4ca47eec9eb |
|
BLAKE2b-256 | d28b8733280a9b6281b9c439649d65ae9c54be3d05f04bf1db4da24446ddec28 |