ernievilgv1

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 4, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package ernievilgv1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	ErnievilgService_Txt2ImgV2_FullMethodName = "/baidubce.ernievilg.v1.ErnievilgService/Txt2ImgV2"
	ErnievilgService_GetImgV2_FullMethodName  = "/baidubce.ernievilg.v1.ErnievilgService/GetImgV2"
)

Variables

View Source
var ErnievilgService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "baidubce.ernievilg.v1.ErnievilgService",
	HandlerType: (*ErnievilgServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Txt2ImgV2",
			Handler:    _ErnievilgService_Txt2ImgV2_Handler,
		},
		{
			MethodName: "GetImgV2",
			Handler:    _ErnievilgService_GetImgV2_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "baidubce/ernievilg/v1/ernievilg_service.proto",
}

ErnievilgService_ServiceDesc is the grpc.ServiceDesc for ErnievilgService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_baidubce_ernievilg_v1_ernievilg_proto protoreflect.FileDescriptor
View Source
var File_baidubce_ernievilg_v1_ernievilg_service_proto protoreflect.FileDescriptor

Functions

func RegisterErnievilgServiceHandler

func RegisterErnievilgServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterErnievilgServiceHandler registers the http handlers for service ErnievilgService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterErnievilgServiceHandlerClient

func RegisterErnievilgServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ErnievilgServiceClient) error

RegisterErnievilgServiceHandlerClient registers the http handlers for service ErnievilgService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ErnievilgServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ErnievilgServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ErnievilgServiceClient" to call the correct interceptors.

func RegisterErnievilgServiceHandlerFromEndpoint

func RegisterErnievilgServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterErnievilgServiceHandlerFromEndpoint is same as RegisterErnievilgServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterErnievilgServiceHandlerServer

func RegisterErnievilgServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ErnievilgServiceServer) error

RegisterErnievilgServiceHandlerServer registers the http handlers for service ErnievilgService to "mux". UnaryRPC :call ErnievilgServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterErnievilgServiceHandlerFromEndpoint instead.

func RegisterErnievilgServiceServer

func RegisterErnievilgServiceServer(s grpc.ServiceRegistrar, srv ErnievilgServiceServer)

Types

type ErnievilgServiceClient

type ErnievilgServiceClient interface {
	Txt2ImgV2(ctx context.Context, in *Txt2ImgV2Request, opts ...grpc.CallOption) (*Txt2ImgV2Response, error)
	GetImgV2(ctx context.Context, in *GetImgV2Request, opts ...grpc.CallOption) (*GetImgV2Response, error)
}

ErnievilgServiceClient is the client API for ErnievilgService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

type ErnievilgServiceServer

type ErnievilgServiceServer interface {
	Txt2ImgV2(context.Context, *Txt2ImgV2Request) (*Txt2ImgV2Response, error)
	GetImgV2(context.Context, *GetImgV2Request) (*GetImgV2Response, error)
}

ErnievilgServiceServer is the server API for ErnievilgService service. All implementations should embed UnimplementedErnievilgServiceServer for forward compatibility

type GetImgV2Request

type GetImgV2Request struct {

	// 是 从提交请求的提交接口的返回值中获取,可使用task_id 查询总任务
	TaskId string `protobuf:"bytes,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"`
	// contains filtered or unexported fields
}

func (*GetImgV2Request) Descriptor deprecated

func (*GetImgV2Request) Descriptor() ([]byte, []int)

Deprecated: Use GetImgV2Request.ProtoReflect.Descriptor instead.

func (*GetImgV2Request) GetTaskId

func (x *GetImgV2Request) GetTaskId() string

func (*GetImgV2Request) ProtoMessage

func (*GetImgV2Request) ProtoMessage()

func (*GetImgV2Request) ProtoReflect

func (x *GetImgV2Request) ProtoReflect() protoreflect.Message

func (*GetImgV2Request) Reset

func (x *GetImgV2Request) Reset()

func (*GetImgV2Request) String

func (x *GetImgV2Request) String() string

type GetImgV2Response

type GetImgV2Response struct {

	// 是 请求唯一标识码
	LogId uint64 `protobuf:"varint,1,opt,name=log_id,json=logId,proto3" json:"log_id,omitempty"`
	// 是 返回数据
	Data *GetImgV2Response_Data `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*GetImgV2Response) Descriptor deprecated

func (*GetImgV2Response) Descriptor() ([]byte, []int)

Deprecated: Use GetImgV2Response.ProtoReflect.Descriptor instead.

func (*GetImgV2Response) GetData

func (*GetImgV2Response) GetLogId

func (x *GetImgV2Response) GetLogId() uint64

func (*GetImgV2Response) ProtoMessage

func (*GetImgV2Response) ProtoMessage()

func (*GetImgV2Response) ProtoReflect

func (x *GetImgV2Response) ProtoReflect() protoreflect.Message

func (*GetImgV2Response) Reset

func (x *GetImgV2Response) Reset()

func (*GetImgV2Response) String

func (x *GetImgV2Response) String() string

type GetImgV2Response_Data

type GetImgV2Response_Data struct {

	// 是 任务 Id
	TaskId uint64 `protobuf:"varint,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"`
	// 是 计算总状态。有 INIT(初始化),WAIT(排队中), RUNNING(生成中), FAILED(失败), SUCCESS(成功)四种状态,只有 SUCCESS 为成功状态,进行计费
	TaskStatus string `protobuf:"bytes,2,opt,name=task_status,json=taskStatus,proto3" json:"task_status,omitempty"`
	// 是 图片生成总进度,进度包含2种,0为未处理完,1为处理完成
	TaskProgress int32 `protobuf:"varint,3,opt,name=task_progress,json=taskProgress,proto3" json:"task_progress,omitempty"`
	// 是 	[] 	子任务生成结果列表
	SubTaskResultList []*GetImgV2Response_TaskResult `protobuf:"bytes,4,rep,name=sub_task_result_list,json=subTaskResultList,proto3" json:"sub_task_result_list,omitempty"`
	// contains filtered or unexported fields
}

func (*GetImgV2Response_Data) Descriptor deprecated

func (*GetImgV2Response_Data) Descriptor() ([]byte, []int)

Deprecated: Use GetImgV2Response_Data.ProtoReflect.Descriptor instead.

func (*GetImgV2Response_Data) GetSubTaskResultList

func (x *GetImgV2Response_Data) GetSubTaskResultList() []*GetImgV2Response_TaskResult

func (*GetImgV2Response_Data) GetTaskId

func (x *GetImgV2Response_Data) GetTaskId() uint64

func (*GetImgV2Response_Data) GetTaskProgress

func (x *GetImgV2Response_Data) GetTaskProgress() int32

func (*GetImgV2Response_Data) GetTaskStatus

func (x *GetImgV2Response_Data) GetTaskStatus() string

func (*GetImgV2Response_Data) ProtoMessage

func (*GetImgV2Response_Data) ProtoMessage()

func (*GetImgV2Response_Data) ProtoReflect

func (x *GetImgV2Response_Data) ProtoReflect() protoreflect.Message

func (*GetImgV2Response_Data) Reset

func (x *GetImgV2Response_Data) Reset()

func (*GetImgV2Response_Data) String

func (x *GetImgV2Response_Data) String() string

type GetImgV2Response_FinalImage

type GetImgV2Response_FinalImage struct {

	// 是 图片所在 BOS http 地址,默认 1 小时失效
	ImgUrl string `protobuf:"bytes,1,opt,name=img_url,json=imgUrl,proto3" json:"img_url,omitempty"`
	// 是 图片像素信息-高度
	Height uint32 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"`
	// 是 图片像素信息-宽度
	Width uint32 `protobuf:"varint,3,opt,name=width,proto3" json:"width,omitempty"`
	// 是 图片机审结果,"block":输入图片违规;"review": 输入图片疑似违规;"pass": 输入图片未发现问题;
	ImgApproveConclusion string `protobuf:"bytes,4,opt,name=img_approve_conclusion,json=imgApproveConclusion,proto3" json:"img_approve_conclusion,omitempty"`
	// contains filtered or unexported fields
}

func (*GetImgV2Response_FinalImage) Descriptor deprecated

func (*GetImgV2Response_FinalImage) Descriptor() ([]byte, []int)

Deprecated: Use GetImgV2Response_FinalImage.ProtoReflect.Descriptor instead.

func (*GetImgV2Response_FinalImage) GetHeight

func (x *GetImgV2Response_FinalImage) GetHeight() uint32

func (*GetImgV2Response_FinalImage) GetImgApproveConclusion

func (x *GetImgV2Response_FinalImage) GetImgApproveConclusion() string

func (*GetImgV2Response_FinalImage) GetImgUrl

func (x *GetImgV2Response_FinalImage) GetImgUrl() string

func (*GetImgV2Response_FinalImage) GetWidth

func (x *GetImgV2Response_FinalImage) GetWidth() uint32

func (*GetImgV2Response_FinalImage) ProtoMessage

func (*GetImgV2Response_FinalImage) ProtoMessage()

func (*GetImgV2Response_FinalImage) ProtoReflect

func (*GetImgV2Response_FinalImage) Reset

func (x *GetImgV2Response_FinalImage) Reset()

func (*GetImgV2Response_FinalImage) String

func (x *GetImgV2Response_FinalImage) String() string

type GetImgV2Response_TaskResult

type GetImgV2Response_TaskResult struct {

	// 是 单风格图片状态。有 INIT(初始化),WAIT(排队中), RUNNING(生成中), FAILED(失败), SUCCESS(成功)四种状态,只有 SUCCESS 为成功状态,进行计费
	SubTaskStatus string `protobuf:"bytes,1,opt,name=sub_task_status,json=subTaskStatus,proto3" json:"sub_task_status,omitempty"`
	// 否 单任务图片生成进度,进度包含2种,0为未处理完,1为处理完成
	SubTaskProgress int32 `protobuf:"varint,2,opt,name=sub_task_progress,json=subTaskProgress,proto3" json:"sub_task_progress,omitempty"`
	// 是 单风格任务错误码。0:正常;501:文本黄反拦截;201:模型生图失败
	SubTaskErrorCode string `protobuf:"bytes,3,opt,name=sub_task_error_code,json=subTaskErrorCode,proto3" json:"sub_task_error_code,omitempty"`
	// 是 	 [] 	单风格任务产出的最终图列表
	FinalImageList *GetImgV2Response_FinalImage `protobuf:"bytes,4,opt,name=final_image_list,json=finalImageList,proto3" json:"final_image_list,omitempty"`
	// contains filtered or unexported fields
}

func (*GetImgV2Response_TaskResult) Descriptor deprecated

func (*GetImgV2Response_TaskResult) Descriptor() ([]byte, []int)

Deprecated: Use GetImgV2Response_TaskResult.ProtoReflect.Descriptor instead.

func (*GetImgV2Response_TaskResult) GetFinalImageList

func (*GetImgV2Response_TaskResult) GetSubTaskErrorCode

func (x *GetImgV2Response_TaskResult) GetSubTaskErrorCode() string

func (*GetImgV2Response_TaskResult) GetSubTaskProgress

func (x *GetImgV2Response_TaskResult) GetSubTaskProgress() int32

func (*GetImgV2Response_TaskResult) GetSubTaskStatus

func (x *GetImgV2Response_TaskResult) GetSubTaskStatus() string

func (*GetImgV2Response_TaskResult) ProtoMessage

func (*GetImgV2Response_TaskResult) ProtoMessage()

func (*GetImgV2Response_TaskResult) ProtoReflect

func (*GetImgV2Response_TaskResult) Reset

func (x *GetImgV2Response_TaskResult) Reset()

func (*GetImgV2Response_TaskResult) String

func (x *GetImgV2Response_TaskResult) String() string

type Txt2ImgV2Request

type Txt2ImgV2Request struct {

	// 是 生图的文本描述。仅支持中文、日常标点符号。不支持英文,特殊符号,限制 200 字
	Prompt string `protobuf:"bytes,1,opt,name=prompt,proto3" json:"prompt,omitempty"`
	// 否 模型版本,支持 v1、v2,默认为v2,v2 为最新模型,比 v1 在准确度、精细度上有比较明显的提升,且 v2 支持更多尺寸
	Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
	// 是 图片宽度,v1 版本支持:1024x1024、1280x720、720x1280、2048x2048、2560x1440、1440x2560;v2 版本支持:512x512、640x360、360x640、1024x1024、1280x720、720x1280、2048x2048、2560x1440、1440x2560
	Width uint32 `protobuf:"varint,3,opt,name=width,proto3" json:"width,omitempty"`
	// 是 图片高度,v1 版本支持:1024x1024、1280x720、720x1280、2048x2048、2560x1440、1440x2560;v2 版本支持:512x512、640x360、360x640、1024x1024、1280x720、720x1280、2048x2048、2560x1440、1440x2560
	Height uint32 `protobuf:"varint,4,opt,name=height,proto3" json:"height,omitempty"`
	// 否 	number 	生成图片数量,默认一张,支持生成 1-8 张
	ImageNum int32 `protobuf:"varint,5,opt,name=image_num,json=imageNum,proto3" json:"image_num,omitempty"`
	// 否,和url/pdf_file 三选一 参考图,需 base64 编码,大小不超过 10M,最短边至少 15px,最长边最大 8192px,支持jpg/jpeg/png/bmp 格式。优先级:image > url > pdf_file,当image 字段存在时,url、pdf_file 字段失效
	Image string `protobuf:"bytes,6,opt,name=image,proto3" json:"image,omitempty"`
	// 否,和image/pdf_file 三选一 参考图完整 url,url 长度不超过 1024 字节,url 对应的图片需 base64 编码,大小不超过 10M,最短边至少 15px,最长边最大8192px,支持 jpg/jpeg/png/bmp 格式。优先级:image > url > pdf_file,当image 字段存在时,url string 字段失效请注意关闭 = 1; URL 防盗链
	Url string `protobuf:"bytes,7,opt,name=url,proto3" json:"url,omitempty"`
	// 否,和image/url 三选一 参考图 PDF 文件,base64 编码,大小不超过10M,最短边至少 15px,最长边最大 8192px 。优先级:image > url > pdf_file,当image 字段存在时,url、pdf_file 字段失效
	PdfFile string `protobuf:"bytes,8,opt,name=pdf_file,json=pdfFile,proto3" json:"pdf_file,omitempty"`
	// 否 需要识别的 PDF 文件的对应页码,当pdf_file 参数有效时,识别传入页码的对应页面内容,若不传入,则默认识别第 1 页
	PdfFileNum string `protobuf:"bytes,9,opt,name=pdf_file_num,json=pdfFileNum,proto3" json:"pdf_file_num,omitempty"`
	// 否,当 image、url或 pdf_file 字段存在时,为必需项 参考图影响因子,支持 1-10 内;数值越大参考图影响越大
	ChangeDegree uint32 `protobuf:"varint,10,opt,name=change_degree,json=changeDegree,proto3" json:"change_degree,omitempty"`
	// contains filtered or unexported fields
}

Txt2ImgV2Request /rpc/2.0/ernievilg/v1/txt2imgv2

func (*Txt2ImgV2Request) Descriptor deprecated

func (*Txt2ImgV2Request) Descriptor() ([]byte, []int)

Deprecated: Use Txt2ImgV2Request.ProtoReflect.Descriptor instead.

func (*Txt2ImgV2Request) GetChangeDegree

func (x *Txt2ImgV2Request) GetChangeDegree() uint32

func (*Txt2ImgV2Request) GetHeight

func (x *Txt2ImgV2Request) GetHeight() uint32

func (*Txt2ImgV2Request) GetImage

func (x *Txt2ImgV2Request) GetImage() string

func (*Txt2ImgV2Request) GetImageNum

func (x *Txt2ImgV2Request) GetImageNum() int32

func (*Txt2ImgV2Request) GetPdfFile

func (x *Txt2ImgV2Request) GetPdfFile() string

func (*Txt2ImgV2Request) GetPdfFileNum

func (x *Txt2ImgV2Request) GetPdfFileNum() string

func (*Txt2ImgV2Request) GetPrompt

func (x *Txt2ImgV2Request) GetPrompt() string

func (*Txt2ImgV2Request) GetUrl

func (x *Txt2ImgV2Request) GetUrl() string

func (*Txt2ImgV2Request) GetVersion

func (x *Txt2ImgV2Request) GetVersion() string

func (*Txt2ImgV2Request) GetWidth

func (x *Txt2ImgV2Request) GetWidth() uint32

func (*Txt2ImgV2Request) ProtoMessage

func (*Txt2ImgV2Request) ProtoMessage()

func (*Txt2ImgV2Request) ProtoReflect

func (x *Txt2ImgV2Request) ProtoReflect() protoreflect.Message

func (*Txt2ImgV2Request) Reset

func (x *Txt2ImgV2Request) Reset()

func (*Txt2ImgV2Request) String

func (x *Txt2ImgV2Request) String() string

type Txt2ImgV2Response

type Txt2ImgV2Response struct {

	// 请求唯一标识码
	LogId uint64 `protobuf:"varint,1,opt,name=log_id,json=logId,proto3" json:"log_id,omitempty"`
	// 返回数据
	Data *Txt2ImgV2Response_Data `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*Txt2ImgV2Response) Descriptor deprecated

func (*Txt2ImgV2Response) Descriptor() ([]byte, []int)

Deprecated: Use Txt2ImgV2Response.ProtoReflect.Descriptor instead.

func (*Txt2ImgV2Response) GetData

func (*Txt2ImgV2Response) GetLogId

func (x *Txt2ImgV2Response) GetLogId() uint64

func (*Txt2ImgV2Response) ProtoMessage

func (*Txt2ImgV2Response) ProtoMessage()

func (*Txt2ImgV2Response) ProtoReflect

func (x *Txt2ImgV2Response) ProtoReflect() protoreflect.Message

func (*Txt2ImgV2Response) Reset

func (x *Txt2ImgV2Response) Reset()

func (*Txt2ImgV2Response) String

func (x *Txt2ImgV2Response) String() string

type Txt2ImgV2Response_Data

type Txt2ImgV2Response_Data struct {

	// 生成图片任务long类型 id,与“task_id”参数输出相同,该 id 可用于查询任务状态
	PrimaryTaskId uint64 `protobuf:"varint,1,opt,name=primary_task_id,json=primaryTaskId,proto3" json:"primary_task_id,omitempty"`
	// 生成图片任务string类型 id,与“primary_task_id”参数输出相同,该 id 可用于查询任务状态
	TaskId string `protobuf:"bytes,2,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"`
	// contains filtered or unexported fields
}

func (*Txt2ImgV2Response_Data) Descriptor deprecated

func (*Txt2ImgV2Response_Data) Descriptor() ([]byte, []int)

Deprecated: Use Txt2ImgV2Response_Data.ProtoReflect.Descriptor instead.

func (*Txt2ImgV2Response_Data) GetPrimaryTaskId

func (x *Txt2ImgV2Response_Data) GetPrimaryTaskId() uint64

func (*Txt2ImgV2Response_Data) GetTaskId

func (x *Txt2ImgV2Response_Data) GetTaskId() string

func (*Txt2ImgV2Response_Data) ProtoMessage

func (*Txt2ImgV2Response_Data) ProtoMessage()

func (*Txt2ImgV2Response_Data) ProtoReflect

func (x *Txt2ImgV2Response_Data) ProtoReflect() protoreflect.Message

func (*Txt2ImgV2Response_Data) Reset

func (x *Txt2ImgV2Response_Data) Reset()

func (*Txt2ImgV2Response_Data) String

func (x *Txt2ImgV2Response_Data) String() string

type UnimplementedErnievilgServiceServer

type UnimplementedErnievilgServiceServer struct {
}

UnimplementedErnievilgServiceServer should be embedded to have forward compatible implementations.

func (UnimplementedErnievilgServiceServer) GetImgV2

func (UnimplementedErnievilgServiceServer) Txt2ImgV2

type UnsafeErnievilgServiceServer

type UnsafeErnievilgServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeErnievilgServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ErnievilgServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL