Spaces:
Runtime error
Runtime error
2023-11-27-07-25-56
Browse files
app.py
CHANGED
|
@@ -1,13 +1,15 @@
|
|
| 1 |
|
| 2 |
import os
|
| 3 |
|
| 4 |
-
os.system("
|
| 5 |
-
os.system("
|
| 6 |
-
|
| 7 |
-
os.system("pip install
|
| 8 |
-
os.system("pip install
|
|
|
|
| 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 |
###########################################################
|