Skip to main content

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(<服务url>,'empty')
print(tool.session.session_id)
tool.install_python_packages(packages)
res1 = tool.upload_files([<上传文件>],['这是要分析的数据'])
res2 = tool.upload_files([<上传图片>],['这是图片'])
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


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.1.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

metalm_tools-0.1.1-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file metalm_tools-0.1.1.tar.gz.

File metadata

  • Download URL: metalm_tools-0.1.1.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

Hashes for metalm_tools-0.1.1.tar.gz
Algorithm Hash digest
SHA256 497a93e069d1a2355acd55c055b7c093ed4c3032a4149f7872b8dd49ccfb01c0
MD5 132ba14227bb88deba7dfcec96a5c9f2
BLAKE2b-256 4ac7491a7a31c5a900fe76e2749f7ca337d047bff3d6c0a13d9c526d34ab0296

See more details on using hashes here.

File details

Details for the file metalm_tools-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for metalm_tools-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0605e951e4322426a8dd8af56dd4a34d56ad4ac8eb759d19d644743bbf5f6da5
MD5 9ca4ee1ddb86b63c634c72f3bcb24066
BLAKE2b-256 63237ae0802d2b729e29ad576d763ad5137d48e14023199a2a62c2f0f2624758

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page