Variables for model names
Browse files
app.py
CHANGED
@@ -1,3 +1,6 @@
|
|
|
|
|
|
|
|
1 |
from dotenv import load_dotenv
|
2 |
import gradio as gr
|
3 |
import numpy as np
|
@@ -28,7 +31,6 @@ else:
|
|
28 |
logging.warning("GEMINI_API_KEY not found in environment variables. Prompt enrichment will not work.")
|
29 |
|
30 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
31 |
-
model_repo_id = "Freepik/F-Lite"
|
32 |
|
33 |
if torch.cuda.is_available():
|
34 |
torch_dtype = torch.bfloat16
|
@@ -200,7 +202,7 @@ css = """
|
|
200 |
|
201 |
with gr.Blocks(css=css, theme="ParityError/Interstellar") as demo:
|
202 |
with gr.Column(elem_id="col-container"):
|
203 |
-
gr.Markdown(" #
|
204 |
|
205 |
with gr.Row(elem_classes="prompt-row"):
|
206 |
prompt = gr.Text(
|
@@ -322,6 +324,9 @@ with gr.Blocks(css=css, theme="ParityError/Interstellar") as demo:
|
|
322 |
example_labels=[ex[0][:max_length] + "..." if len(ex[0]) > max_length else ex[0] for ex in examples]
|
323 |
)
|
324 |
|
|
|
|
|
|
|
325 |
# Update width and height when resolution dropdown changes
|
326 |
resolution_dropdown.change(
|
327 |
fn=update_resolution,
|
@@ -347,8 +352,6 @@ with gr.Blocks(css=css, theme="ParityError/Interstellar") as demo:
|
|
347 |
outputs=[result, seed, enriched_prompt_display, enriched_prompt_text, enrichment_error],
|
348 |
)
|
349 |
|
350 |
-
# Add link to model card
|
351 |
-
gr.Markdown("[F-Lite Model Card and Weights](https://huggingface.co/Freepik/F-Lite)")
|
352 |
|
353 |
if __name__ == "__main__":
|
354 |
demo.launch() # server_name="0.0.0.0", share=True)
|
|
|
1 |
+
model_repo_id = "Freepik/F-Lite"
|
2 |
+
model_name = "F Lite"
|
3 |
+
|
4 |
from dotenv import load_dotenv
|
5 |
import gradio as gr
|
6 |
import numpy as np
|
|
|
31 |
logging.warning("GEMINI_API_KEY not found in environment variables. Prompt enrichment will not work.")
|
32 |
|
33 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
34 |
|
35 |
if torch.cuda.is_available():
|
36 |
torch_dtype = torch.bfloat16
|
|
|
202 |
|
203 |
with gr.Blocks(css=css, theme="ParityError/Interstellar") as demo:
|
204 |
with gr.Column(elem_id="col-container"):
|
205 |
+
gr.Markdown(f" # {model_name} Text-to-Image Demo")
|
206 |
|
207 |
with gr.Row(elem_classes="prompt-row"):
|
208 |
prompt = gr.Text(
|
|
|
324 |
example_labels=[ex[0][:max_length] + "..." if len(ex[0]) > max_length else ex[0] for ex in examples]
|
325 |
)
|
326 |
|
327 |
+
# Add link to model card
|
328 |
+
gr.Markdown(f"[{model_name} Model Card and Weights](https://huggingface.co/{model_repo_id})")
|
329 |
+
|
330 |
# Update width and height when resolution dropdown changes
|
331 |
resolution_dropdown.change(
|
332 |
fn=update_resolution,
|
|
|
352 |
outputs=[result, seed, enriched_prompt_display, enriched_prompt_text, enrichment_error],
|
353 |
)
|
354 |
|
|
|
|
|
355 |
|
356 |
if __name__ == "__main__":
|
357 |
demo.launch() # server_name="0.0.0.0", share=True)
|