mckabue commited on
Commit
266b856
Β·
1 Parent(s): ac098f2

2023-11-27-07-25-56

Browse files
Files changed (1) hide show
  1. app.py +9 -7
app.py CHANGED
@@ -1,13 +1,15 @@
1
 
2
  import os
3
 
4
- os.system("pip install torch")
5
- os.system("pip install 'git+https://github.com/facebookresearch/detectron2.git'")
6
- os.system("pip install layoutparser")
7
- os.system("pip install layoutparser[layoutmodels]")
8
- os.system("pip install layoutparser[ocr]")
 
9
  os.system("pip install Pillow==9.4.0")
10
- os.system("pip install requests")
 
11
 
12
  import gradio as gr
13
  import layoutparser as lp
@@ -78,7 +80,7 @@ def inference_factory(config_path: str, model_path: str, label_map: dict, color_
78
  return error if just_image else [None, error, threshold]
79
  if not launch:
80
  return fn
81
-
82
  ###########################################################
83
  ################### Start of Gradio setup #################
84
  ###########################################################
 
1
 
2
  import os
3
 
4
+ os.system("python3 -m venv mini-env")
5
+ os.system("source mini-env/bin/activate")
6
+
7
+ os.system("pip install torch==2.1.0+cu118 torchvision torchaudio")
8
+ os.system("pip install 'git+https://github.com/facebookresearch/detectron2.git@v0.6'")
9
+ os.system("pip install layoutparser==0.3.4 layoutparser[layoutmodels] layoutparser[ocr]")
10
  os.system("pip install Pillow==9.4.0")
11
+ os.system("pip install requests==2.31.0")
12
+ os.system("pip install -q gradio==4.7.1")
13
 
14
  import gradio as gr
15
  import layoutparser as lp
 
80
  return error if just_image else [None, error, threshold]
81
  if not launch:
82
  return fn
83
+
84
  ###########################################################
85
  ################### Start of Gradio setup #################
86
  ###########################################################