小编dhi*_*nar的帖子

从烧瓶中的文件存储对象中提取文件

我正在学习如何在Flask中处理文件上传。从这里开始,我使用pdf文件上传并阅读了其中的内容。这发生在client.py文件中。

现在我想将文件从客户端传递到本地运行的服务器。当我使用request.file时,它将作为FileStorage Object获取。因此,在不保存或提供文件路径的情况下,我想从客户端上传文件并将其传递给服务器以进行进一步处理。

class mainSessRunning():
     def proces(input):
     ...
     ...
     return result

run = mainSessRunning()

@app.route('/input', methods=['POST'])
def input():
    input_file = request.files['file']
   ...(extract file from filestorage object "input_file")...
    result = run.process(file) ## process is user defined function 
    return (result)
Run Code Online (Sandbox Code Playgroud)

在这里,我想通过process()功能将传入文件发送到本地运行的服务器。我该怎么做呢?我遇到相同的问题,但找不到任何东西

python file-upload flask python-2.7 object-storage

7
推荐指数
1
解决办法
4278
查看次数

TypeError: 使用flask 读取pdf 文件时预期str、bytes 或os.PathLike 对象,而不是FileStorage

我正在尝试使用 Flask 应用程序读取 python 文件。我正在使用 pdfminer 阅读 pdf 文本。

@app.route('/getfile', methods=['POST'])
def getfile():
    request_data = request.files['file']
    rsrcmgr = PDFResourceManager()
    retstr = io.StringIO()
    codec = 'utf-8'
    laparams = LAParams()
    device = TextConverter(rsrcmgr, retstr, codec=codec, laparams=laparams)
    fp = open(request_data, 'rb')
    interpreter = PDFPageInterpreter(rsrcmgr, device)
    password = ""
    maxpages = 0
    caching = True
    pagenos = set()

    for page in PDFPage.get_pages(fp, pagenos, maxpages=maxpages,
                                  password=password,
                                  caching=caching,
                                  check_extractable=True):
        interpreter.process_page(page)

    text = retstr.getvalue()

    fp.close()
    device.close()
    retstr.close()
return text
Run Code Online (Sandbox Code Playgroud)

不幸的是它抛出错误,

python flask python-3.x

5
推荐指数
1
解决办法
8094
查看次数

Highcharts 中的 dash_styles

我正在尝试更改 Highcharts 中折线图的 dashStyle。

我参考了RDocumentation,第 7 页,在任何地方都没有它的例子。它所说的只是使用dash_styles()

然后我在这里检查并尝试过,但它并没有导致我需要的东西。

library(highcharter)
  highchart() %>% 
    hc_title(text = title) %>% 
    hc_xAxis(categories = batchno) %>% 
    hc_add_series(name = "Mixer A", data = A,
                  color = "hotpink", pointWidth = 20, type = "line",
                 dash_styles(style = "LongDot")) %>% 
    hc_add_series(name = "Mixer B" , data = B,
                  color =  "slateblue", pointWidth = 20,type = "line") %>%

    hc_chart(type = "column") %>% 

    hc_yAxis(
      list(lineWidth = 3, lineColor='seashell', title=list(text= "text"),max= 10)) %>% hc_tooltip(crosshairs = TRUE, shared =  TRUE) …
Run Code Online (Sandbox Code Playgroud)

r linechart highcharts r-highcharter

3
推荐指数
1
解决办法
948
查看次数

“-t,--tag”标志的无效参数“/tensorflow-serving-devel”:无效的参考格式

我正在尝试为这里的tensforflow 服务创建一个 docker 图像。

当我尝试使用所有必需的依赖项(pip 依赖项、bazel、grpc)拉取 docker 镜像时 在此处输入图片说明

我在这里做错了什么?我相信它适用于除我之外的所有人。我在 Windows 7 中使用 docker 工具箱,这是我第一次使用 docker。我不知道这个错误说的是什么

编辑:删除空格后 在此处输入图片说明

码头工人版本

在此处输入图片说明

git git-clone docker tensorflow tensorflow-serving

3
推荐指数
2
解决办法
2万
查看次数