Unverified Commit ece7f8d5 authored by Kaiwen Liu's avatar Kaiwen Liu Committed by GitHub
Browse files

Merge pull request #6 from opendatalab/dev

Dev
parents 98362a6e 702b6ac9
export const windowOpen = (
url: string,
type?: "_blank" | "_parent" | "_self" | "_top"
) => {
const a = document.createElement("a");
a.setAttribute("href", url);
a.setAttribute("target", type || "_blank");
a.rel = "noreferrer";
document.body.appendChild(a);
if (a.click) {
a?.click();
} else {
try {
let evt = new Event("click", {
bubbles: false,
cancelable: true,
});
a.dispatchEvent(evt);
} catch (error) {
window.open(url, type || "_blank");
}
}
document.body.removeChild(a);
};
/// <reference types="vite/client" />
module.exports = {
content: [
"./src/**/*.{js,jsx,ts,tsx}",
],
plugins: [
function ({ addUtilities }) {
const newUtilities = {
'.scrollbar-thin': {
scrollbarWidth: '2px',
// scrollbarColor: 'rgba(13, 83, 222, 1)',
'&::-webkit-scrollbar': {
width: '6px',
height: '6px'
},
'&::-webkit-scrollbar-track': {
backgroundColor: 'transparent'
},
'&::-webkit-scrollbar-thumb': {
// backgroundColor: 'rgba(13, 83, 222, 0.01)',
borderRadius: '20px',
border: '3px solid transparent'
},
'&:hover::-webkit-scrollbar-thumb': {
width: '6px',
border: '3px solid rgb(229 231 235)',
backgroundColor: 'rgb(229 231 235)'
}
}
// 你可以添加更多自定义的滚动条样式
};
addUtilities(newUtilities, ['responsive', 'hover']);
},
],
// ...other configurations
}
\ No newline at end of file
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"isolatedModules": true,
"moduleDetection": "force",
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["src"]
}
{
"files": [],
"compilerOptions": {
// ... other options ...
"types": ["node"]
},
"references": [
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.node.json" }
]
}
{
"compilerOptions": {
"target": "ES2022",
"lib": ["ES2023"],
"module": "ESNext",
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"isolatedModules": true,
"moduleDetection": "force",
"noEmit": true,
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["vite.config.ts"]
}
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import path from "path";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
server: {
proxy: {
"/api": {
target: "http://localhost:5559",
changeOrigin: true,
},
},
},
css: {
modules: {
localsConvention: "camelCaseOnly", // transfer kebab-case to camelCase
scopeBehaviour: "local",
generateScopedName: "[name]__[local]___[hash:base64:5]",
},
},
publicDir: "public",
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
});
## 安装
基于MinerU的PDF解析API
MinerU
- MinerU的GPU镜像构建
- 基于FastAPI的PDF解析接口
```bash
# mineru已安装则跳过此步骤
支持一键启动,已经打包到镜像中,自带模型权重,支持GPU推理加速,GPU速度相比CPU每页解析要快几十倍不等
git clone https://github.com/opendatalab/MinerU.git
cd MinerU
conda create -n MinerU python=3.10
conda activate MinerU
pip install .[full] --extra-index-url https://wheels.myhloli.com
```
## 启动命令:
第三方软件
```bash
cd projects/web_api
pip install poetry
portey install
```
```docker run -itd --name=mineru_server --gpus=all -p 8888:8000 quincyqiang/mineru:0.1-models```
![](https://i-blog.csdnimg.cn/direct/bcff4f524ea5400db14421ba7cec4989.png)
具体截图请见博客:https://blog.csdn.net/yanqianglifei/article/details/141979684
## 启动日志:
![](https://i-blog.csdnimg.cn/direct/4eb5657567e4415eba912179dca5c8aa.png)
## 输入参数:
访问地址:
http://localhost:8888/docs
http://127.0.01:8888/docs
![](https://i-blog.csdnimg.cn/direct/8b3a2bc5908042268e8cc69756e331a2.png)
## 解析效果:
![](https://i-blog.csdnimg.cn/direct/a54dcae834ae48d498fb595aca4212c3.png)
## 镜像地址:
> 阿里云地址:docker pull registry.cn-beijing.aliyuncs.com/quincyqiang/mineru:0.1-models
> dockerhub地址:docker pull quincyqiang/mineru:0.1-models
接口文档
```
在浏览器打开 mineru-web接口文档.html
```
# MinerU Local web_demo
## Feature Overview
<p align="center">
<img src="images/web_demo_1.png" width="600px" style="vertical-align:middle;">
</p>
- Supports uploading PDFs and calling MinerU for processing
- Supports online editing of the Markdown results parsed by MinerU
- Supports viewing of historical tasks
## Installation and Deployment
0. MinerU Installation and Deployment
```
# The service depends on mineru, please ensure mineru is installed first
```
1. Package the front-end interface
```bash
# First, navigate to the front-end directory
cd projects/web
# Modify the configuration
# Change the IP in the target field of the file vite.config.ts to your own computer's IP
# Build the front-end project
npm install -g yarn
yarn install
yarn build
```
2. Install service dependencies
```bash
# First, navigate to the back-end directory
cd projects/web_demo
# Install dependencies
pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
```
3. Start the service
```bash
# Navigate to the program directory
cd projects/web_demo/web_demo
# Start the service
python3 app.py or python app.py
# Access the interface by visiting the started address in the browser
```
ps:API documentation
```
Open the mineru-web API mineru-web接口文档.html in the browser
```
# MinerU本地web_demo
## 功能简介
<p align="center">
<img src="images/web_demo_1.png" width="600px" style="vertical-align:middle;">
</p>
- 支持上传pdf,并调用MinerU进行处理
- 支持对MinerU解析的Markdown结果进行在线修改
- 支持查看历史任务
## 安装部署
0. MinerU安装部署
```
# 服务依赖MinerU,请先确保MinerU已安装
```
1. 打包前端界面
```bash
# 先进入前端目录
cd projects/web
# 修改配置
# 将文件vite.config.ts中的target中的IP更改为自己电脑IP
# 打包前端项目
npm install -g yarn
yarn install
yarn build
```
2. 安装服务依赖
```bash
# 先进入后端目录
cd projects/web_demo
# 安装依赖
pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
```
3. 启动服务
```bash
# 进入程序目录
cd projects/web_demo/web_demo
# 启动服务
python3 app.py 或者 python app.py
# 在浏览器访问启动的地址即可访问界面
```
ps:接口文档
```
在浏览器打开 mineru-web接口文档.html
```
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment