Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -12,23 +12,21 @@ import atexit
|
|
12 |
import subprocess
|
13 |
import webbrowser
|
14 |
import urllib.parse
|
15 |
-
import
|
16 |
-
import spaces
|
17 |
import torch
|
18 |
from accelerate import Accelerator
|
19 |
|
20 |
-
import warnings
|
21 |
warnings.filterwarnings('ignore', category=UserWarning, module='__main__')
|
22 |
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
|
23 |
|
24 |
@spaces.GPU
|
25 |
def initialize_environment(input_file, output_directory):
|
26 |
"""Initialize application environment and configurations"""
|
27 |
-
directories = ['logs', 'resolutions', 'repos']
|
28 |
for directory in directories:
|
29 |
os.makedirs(directory, exist_ok=True)
|
30 |
|
31 |
-
log_file = f"logs/github_bot_{datetime.now().
|
32 |
logging.basicConfig(
|
33 |
level=logging.INFO,
|
34 |
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
@@ -47,7 +45,11 @@ def initialize_environment(input_file, output_directory):
|
|
47 |
sys.excepthook = handle_exception
|
48 |
return logging.getLogger(__name__)
|
49 |
|
50 |
-
|
|
|
|
|
|
|
|
|
51 |
|
52 |
class GitHubAPI:
|
53 |
"""GitHub API handler with rate limiting and error handling"""
|
@@ -116,7 +118,7 @@ class GitHubBot:
|
|
116 |
def __init__(self):
|
117 |
self.github_api = None
|
118 |
|
119 |
-
def initialize_api(self, token: str
|
120 |
"""Initialize GitHub API with token"""
|
121 |
self.github_api = GitHubAPI(token)
|
122 |
|
|
|
12 |
import subprocess
|
13 |
import webbrowser
|
14 |
import urllib.parse
|
15 |
+
import warnings
|
|
|
16 |
import torch
|
17 |
from accelerate import Accelerator
|
18 |
|
|
|
19 |
warnings.filterwarnings('ignore', category=UserWarning, module='__main__')
|
20 |
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
|
21 |
|
22 |
@spaces.GPU
|
23 |
def initialize_environment(input_file, output_directory):
|
24 |
"""Initialize application environment and configurations"""
|
25 |
+
directories = ['logs', 'resolutions', 'repos', input_file, output_directory]
|
26 |
for directory in directories:
|
27 |
os.makedirs(directory, exist_ok=True)
|
28 |
|
29 |
+
log_file = f"logs/github_bot_{datetime.now().strftime('%Y%m%d_%H%M%S')}.log"
|
30 |
logging.basicConfig(
|
31 |
level=logging.INFO,
|
32 |
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
|
|
45 |
sys.excepthook = handle_exception
|
46 |
return logging.getLogger(__name__)
|
47 |
|
48 |
+
# Example user inputs for input and output directories
|
49 |
+
input_directory = 'input'
|
50 |
+
output_directory = 'output'
|
51 |
+
|
52 |
+
logger = initialize_environment(input_directory, output_directory)
|
53 |
|
54 |
class GitHubAPI:
|
55 |
"""GitHub API handler with rate limiting and error handling"""
|
|
|
118 |
def __init__(self):
|
119 |
self.github_api = None
|
120 |
|
121 |
+
def initialize_api(self, token: str):
|
122 |
"""Initialize GitHub API with token"""
|
123 |
self.github_api = GitHubAPI(token)
|
124 |
|