Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ from transformers import AutoConfig, AutoModelForCausalLM
|
|
4 |
from janus.models import MultiModalityCausalLM, VLChatProcessor
|
5 |
from PIL import Image
|
6 |
import numpy as np
|
7 |
-
import spaces
|
8 |
|
9 |
# Load the model and processor
|
10 |
model_path = "deepseek-ai/Janus-Pro-7B"
|
@@ -114,9 +114,12 @@ def create_interface():
|
|
114 |
""")
|
115 |
|
116 |
prompt_input = gr.Textbox(label="Prompt (describe the image)")
|
117 |
-
|
118 |
-
|
119 |
-
|
|
|
|
|
|
|
120 |
|
121 |
generate_button = gr.Button("Generate Images")
|
122 |
output_gallery = gr.Gallery(label="Generated Images", columns=2, height=300)
|
@@ -127,22 +130,20 @@ def create_interface():
|
|
127 |
outputs=output_gallery
|
128 |
)
|
129 |
|
130 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
|
132 |
-
|
133 |
-
gr.Markdown("""
|
134 |
-
<hr>
|
135 |
-
<p style="text-align: center; font-size: 0.9em;">
|
136 |
-
Created with ❤️ by <a href="https://bilsimaging.com" target="_blank">bilsimaging.com</a>
|
137 |
-
</p>
|
138 |
-
""")
|
139 |
-
|
140 |
-
# Visitor Badge
|
141 |
-
gr.HTML("""
|
142 |
-
<a href="https://visitorbadge.io/status?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2FBils%2Fradiogold">
|
143 |
-
<img src="https://api.visitorbadge.io/api/visitors?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2FBils%2Fradiogold&countColor=%23263759" />
|
144 |
-
</a>
|
145 |
-
""")
|
146 |
|
147 |
demo = create_interface()
|
148 |
demo.launch(share=True)
|
|
|
4 |
from janus.models import MultiModalityCausalLM, VLChatProcessor
|
5 |
from PIL import Image
|
6 |
import numpy as np
|
7 |
+
import spaces # Import spaces for ZeroGPU compatibility
|
8 |
|
9 |
# Load the model and processor
|
10 |
model_path = "deepseek-ai/Janus-Pro-7B"
|
|
|
114 |
""")
|
115 |
|
116 |
prompt_input = gr.Textbox(label="Prompt (describe the image)")
|
117 |
+
|
118 |
+
# Option to toggle additional parameters
|
119 |
+
with gr.Accordion("Advanced Parameters", open=False):
|
120 |
+
seed_input = gr.Number(label="Seed (Optional)", value=12345, precision=0)
|
121 |
+
guidance_slider = gr.Slider(label="CFG Guidance Weight", minimum=1, maximum=10, value=5, step=0.5)
|
122 |
+
temperature_slider = gr.Slider(label="Temperature", minimum=0, maximum=1, value=1.0, step=0.05)
|
123 |
|
124 |
generate_button = gr.Button("Generate Images")
|
125 |
output_gallery = gr.Gallery(label="Generated Images", columns=2, height=300)
|
|
|
130 |
outputs=output_gallery
|
131 |
)
|
132 |
|
133 |
+
# Footer
|
134 |
+
gr.Markdown("""
|
135 |
+
<hr>
|
136 |
+
<p style="text-align: center; font-size: 0.9em;">
|
137 |
+
Created with ❤️ by <a href="https://bilsimaging.com" target="_blank">bilsimaging.com</a>
|
138 |
+
</p>
|
139 |
+
""")
|
140 |
+
|
141 |
+
# Visitor Badge
|
142 |
+
gr.HTML("""
|
143 |
+
<a href="https://visitorbadge.io/status?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2FBils%2FDeepseekJanusPro%2F"><img src="https://api.visitorbadge.io/api/visitors?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2FBils%2FDeepseekJanusPro%2F&countColor=%23263759" /></a>
|
144 |
+
""")
|
145 |
|
146 |
+
return demo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
|
148 |
demo = create_interface()
|
149 |
demo.launch(share=True)
|