53 lines
1.4 KiB
Python
53 lines
1.4 KiB
Python
# import sys
|
||
|
||
# from fastapi import FastAPI
|
||
# from fastapi.staticfiles import StaticFiles
|
||
# version = f"{sys.version_info.major}.{sys.version_info.minor}"
|
||
|
||
# app = FastAPI()
|
||
|
||
# # 将 /root/app 目录挂载为静态文件
|
||
# app.mount("/files", StaticFiles(directory="/root/app"), name="files")
|
||
|
||
# @app.get("/")
|
||
# async def read_root():
|
||
# message = f"Hello world! From FastAPI running on Uvicorn with Gunicorn. Using Python {version}"
|
||
# return {"message": message}
|
||
|
||
|
||
# from PIL import Image
|
||
# import pandas as pd
|
||
|
||
# # 读取图片
|
||
# image_path = '/home/xiazj/ai-station-code/tmp/dimaoshibie/d94afe94-2fae-4ce5-9ee4-94ac1d699337/merge_binary_dimao2.jpg' # 替换成你的图片路径
|
||
# image = Image.open(image_path)
|
||
|
||
# # 获取图片的RGB数据
|
||
# pixels = list(image.getdata())
|
||
|
||
# # 创建一个DataFrame来统计每种颜色的出现次数
|
||
# color_counts = pd.Series(pixels).value_counts()
|
||
|
||
# # 将颜色统计结果转换为DataFrame
|
||
# color_summary = color_counts.reset_index()
|
||
# color_summary.columns = ['RGB', 'Count']
|
||
|
||
# # 打印结果
|
||
# print(color_summary)
|
||
|
||
# # 可选:将结果保存到CSV文件
|
||
# color_summary.to_csv('color_summary.csv', index=False)
|
||
|
||
import pickle
|
||
|
||
# 指定文件路径
|
||
file_path = '/home/xiazj/ai-station-code/tmp/sam/c768f709-b123-48fb-b98b-addf0bbb8a04/model_params.pickle'
|
||
|
||
# 读取 pickle 文件
|
||
with open(file_path, 'rb') as file:
|
||
data,api = pickle.load(file)
|
||
|
||
# 打印数据
|
||
print(data)
|
||
print(api)
|