rafmacalaba commited on
Commit
bab3a78
·
1 Parent(s): ca564b0

Runtime install of ai4data_use via GH_TOKEN

Browse files
Files changed (2) hide show
  1. app.py +15 -0
  2. requirements.txt +0 -1
app.py CHANGED
@@ -1,4 +1,19 @@
1
  import gradio as gr
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  from ai4data import extract_from_text
3
  DATA_MODEL_ID = "rafmacalaba/datause-extraction-v3-finetuned"
4
  DATASET_COLORS = {
 
1
  import gradio as gr
2
+ import os
3
+ import subprocess
4
+
5
+ GH_TOKEN = os.getenv("GH_TOKEN")
6
+ if GH_TOKEN:
7
+ subprocess.run(
8
+ [
9
+ "pip", "install",
10
+ f"git+https://{GH_TOKEN}:x-oauth-basic@github.com/rafmacalaba/ai4data_use.git"
11
+ ],
12
+ check=True
13
+ )
14
+ else:
15
+ print("⚠️ GH_TOKEN not found. Private ai4data_use will NOT be installed.")
16
+
17
  from ai4data import extract_from_text
18
  DATA_MODEL_ID = "rafmacalaba/datause-extraction-v3-finetuned"
19
  DATASET_COLORS = {
requirements.txt CHANGED
@@ -1,5 +1,4 @@
1
  gradio>=4.0.0
2
- git+https://${GH_TOKEN}@github.com/rafmacalaba/ai4data_use.git
3
  datasets
4
  transformers
5
  accelerate
 
1
  gradio>=4.0.0
 
2
  datasets
3
  transformers
4
  accelerate