Spaces:
Sleeping
Sleeping
Andre
commited on
Commit
·
fbb01db
1
Parent(s):
9c69778
Update
Browse files- app.py +12 -2
- colab.ipynb +10 -3
- src/gradio_interface.py +1 -1
- src/img_gen_logic.py +1 -1
app.py
CHANGED
@@ -1,5 +1,15 @@
|
|
1 |
-
#
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
if __name__ == "__main__":
|
5 |
# Launch the Gradio app
|
|
|
1 |
+
# app.py
|
2 |
+
import sys
|
3 |
+
import os
|
4 |
+
|
5 |
+
# Add the src folder to the Python path
|
6 |
+
src_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "src"))
|
7 |
+
if src_path not in sys.path:
|
8 |
+
sys.path.append(src_path)
|
9 |
+
|
10 |
+
# Import gradio_interface
|
11 |
+
from gradio_interface import demo
|
12 |
+
|
13 |
|
14 |
if __name__ == "__main__":
|
15 |
# Launch the Gradio app
|
colab.ipynb
CHANGED
@@ -7,14 +7,21 @@
|
|
7 |
"outputs": [],
|
8 |
"source": [
|
9 |
"# colab.ipynb\n",
|
10 |
-
"
|
11 |
"import os\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
"import random\n",
|
13 |
"import ipywidgets as widgets\n",
|
14 |
"from huggingface_hub import InferenceClient\n",
|
15 |
"from IPython.display import display, clear_output\n",
|
16 |
-
"from
|
17 |
-
"from
|
18 |
"from PIL import Image\n",
|
19 |
"from google.colab import userdata\n",
|
20 |
"from datetime import datetime\n",
|
|
|
7 |
"outputs": [],
|
8 |
"source": [
|
9 |
"# colab.ipynb\n",
|
10 |
+
"import sys\n",
|
11 |
"import os\n",
|
12 |
+
"\n",
|
13 |
+
"# Add the root folder to the Python path\n",
|
14 |
+
"root_path = os.path.abspath(\"\")\n",
|
15 |
+
"if root_path not in sys.path:\n",
|
16 |
+
" sys.path.append(root_path)\n",
|
17 |
+
"\n",
|
18 |
+
"# Import necessary libraries\n",
|
19 |
"import random\n",
|
20 |
"import ipywidgets as widgets\n",
|
21 |
"from huggingface_hub import InferenceClient\n",
|
22 |
"from IPython.display import display, clear_output\n",
|
23 |
+
"from img_gen_logic_colab import generate_image, save_image\n",
|
24 |
+
"from config_colab import models, prompts, api_token # Import from config folder\n",
|
25 |
"from PIL import Image\n",
|
26 |
"from google.colab import userdata\n",
|
27 |
"from datetime import datetime\n",
|
src/gradio_interface.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
# gradio_interface.py (HuggingFace Spaces)
|
2 |
import gradio as gr
|
3 |
-
from img_gen_logic import generate_image # Direct import
|
4 |
from config.config import prompts, models # Direct import
|
5 |
|
6 |
def generate(prompt_alias, team, model_alias, custom_prompt, height=360, width=640, num_inference_steps=20, guidance_scale=2.0, seed=-1):
|
|
|
1 |
# gradio_interface.py (HuggingFace Spaces)
|
2 |
import gradio as gr
|
3 |
+
from src.img_gen_logic import generate_image # Direct import
|
4 |
from config.config import prompts, models # Direct import
|
5 |
|
6 |
def generate(prompt_alias, team, model_alias, custom_prompt, height=360, width=640, num_inference_steps=20, guidance_scale=2.0, seed=-1):
|
src/img_gen_logic.py
CHANGED
@@ -3,7 +3,7 @@ import random
|
|
3 |
from huggingface_hub import InferenceClient
|
4 |
from PIL import Image
|
5 |
from datetime import datetime
|
6 |
-
from config import api_token, models, prompts # Direct import
|
7 |
|
8 |
|
9 |
def generate_image(prompt_alias, team, model_alias, custom_prompt, height=360, width=640, num_inference_steps=20, guidance_scale=2.0, seed=-1):
|
|
|
3 |
from huggingface_hub import InferenceClient
|
4 |
from PIL import Image
|
5 |
from datetime import datetime
|
6 |
+
from config.config import api_token, models, prompts # Direct import
|
7 |
|
8 |
|
9 |
def generate_image(prompt_alias, team, model_alias, custom_prompt, height=360, width=640, num_inference_steps=20, guidance_scale=2.0, seed=-1):
|