Spaces:
Sleeping
Sleeping
Andre
commited on
Commit
·
09faead
1
Parent(s):
2a42615
“Update”
Browse files- app.py +1 -6
- config/config.py +1 -1
- src/img_gen.py +3 -2
app.py
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
import sys
|
3 |
import os
|
4 |
|
|
|
5 |
# Add the src folder to the Python path
|
6 |
# Solves all problems w subfolders - option2
|
7 |
src_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "src"))
|
@@ -10,12 +11,6 @@ if src_path not in sys.path:
|
|
10 |
|
11 |
# Import gradio_interface
|
12 |
from gradio_interface import demo
|
13 |
-
from config.config import api_token
|
14 |
-
from huggingface_hub import InferenceClient
|
15 |
-
from config.models import models
|
16 |
-
|
17 |
-
# Initialize the InferenceClient with the default model
|
18 |
-
client = InferenceClient(models[0]["name"], token=api_token)
|
19 |
|
20 |
|
21 |
if __name__ == "__main__":
|
|
|
2 |
import sys
|
3 |
import os
|
4 |
|
5 |
+
|
6 |
# Add the src folder to the Python path
|
7 |
# Solves all problems w subfolders - option2
|
8 |
src_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "src"))
|
|
|
11 |
|
12 |
# Import gradio_interface
|
13 |
from gradio_interface import demo
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
|
16 |
if __name__ == "__main__":
|
config/config.py
CHANGED
@@ -4,7 +4,7 @@ from config.prompts import prompts # Import prompts from prompts.py
|
|
4 |
from config.models import models
|
5 |
|
6 |
# Retrieve the Hugging Face token
|
7 |
-
|
8 |
|
9 |
# Debugging: Check if the Hugging Face token is available
|
10 |
if not api_token:
|
|
|
4 |
from config.models import models
|
5 |
|
6 |
# Retrieve the Hugging Face token
|
7 |
+
#pi_token = os.getenv("HF_CTB_TOKEN")
|
8 |
|
9 |
# Debugging: Check if the Hugging Face token is available
|
10 |
if not api_token:
|
src/img_gen.py
CHANGED
@@ -4,8 +4,7 @@ import os
|
|
4 |
import random
|
5 |
from huggingface_hub import InferenceClient
|
6 |
from datetime import datetime
|
7 |
-
from config.config import
|
8 |
-
|
9 |
|
10 |
def generate(prompt_alias, team, model_alias, custom_prompt, height=360, width=640, num_inference_steps=20, guidance_scale=2.0, seed=-1):
|
11 |
try:
|
@@ -18,6 +17,8 @@ def generate(prompt_alias, team, model_alias, custom_prompt, height=360, width=6
|
|
18 |
|
19 |
def generate_image(prompt_alias, team, model_alias, custom_prompt, height=360, width=640, num_inference_steps=20, guidance_scale=2.0, seed=-1):
|
20 |
# Debugging: Check if the token is available
|
|
|
|
|
21 |
if not api_token:
|
22 |
return None, "ERROR: Hugging Face token (HF_CTB_TOKEN) is missing. Please set it as an environment variable."
|
23 |
|
|
|
4 |
import random
|
5 |
from huggingface_hub import InferenceClient
|
6 |
from datetime import datetime
|
7 |
+
from config.config import models, prompts # Direct import
|
|
|
8 |
|
9 |
def generate(prompt_alias, team, model_alias, custom_prompt, height=360, width=640, num_inference_steps=20, guidance_scale=2.0, seed=-1):
|
10 |
try:
|
|
|
17 |
|
18 |
def generate_image(prompt_alias, team, model_alias, custom_prompt, height=360, width=640, num_inference_steps=20, guidance_scale=2.0, seed=-1):
|
19 |
# Debugging: Check if the token is available
|
20 |
+
api_token = os.getenv("HF_CTB_TOKEN")
|
21 |
+
|
22 |
if not api_token:
|
23 |
return None, "ERROR: Hugging Face token (HF_CTB_TOKEN) is missing. Please set it as an environment variable."
|
24 |
|