Kohaku-Blueleaf commited on
Commit
40cbba8
1 Parent(s): a1372fa

try to install needed module from code

Browse files
Files changed (2) hide show
  1. app.py +11 -1
  2. requirements.txt +0 -1
app.py CHANGED
@@ -1,6 +1,16 @@
1
- import sys
2
  import gradio as gr
3
 
 
 
 
 
 
 
 
 
 
 
4
  import re
5
  import random
6
  from time import time
 
1
+ import sys, os
2
  import gradio as gr
3
 
4
+ ## if kgen not exist
5
+ try:
6
+ import kgen
7
+ except:
8
+ GH_TOKEN = os.getenv("GITHUB_TOKEN")
9
+ git_url = f"https://{GH_TOKEN}@github.com/KohakuBlueleaf/TITPOP-KGen@titpop"
10
+
11
+ ## call pip install
12
+ os.system(f"pip install git+{git_url}")
13
+
14
  import re
15
  import random
16
  from time import time
requirements.txt CHANGED
@@ -1,3 +1,2 @@
1
- git+https://${GITHUB_TOKEN}@github.com/KohakuBlueleaf/TITPOP-KGen@titpop
2
  gradio
3
  spaces
 
 
1
  gradio
2
  spaces