Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -31,13 +31,11 @@ def generate_image(prompt, model_choice, translate=False):
|
|
31 |
if translate:
|
32 |
prompt = translate_text(prompt, target_language='en') # Assuming you want to translate to English
|
33 |
model_urls = {
|
34 |
-
|
35 |
"dalle-3-xl-v2": "https://api-inference.huggingface.co/models/ehristoforu/dalle-3-xl-v2",
|
36 |
"midjourney-v6": "https://api-inference.huggingface.co/models/Kvikontent/midjourney-v6",
|
37 |
"openjourney-v4": "https://api-inference.huggingface.co/models/prompthero/openjourney-v4",
|
38 |
"LCM_Dreamshaper_v7": "https://api-inference.huggingface.co/models/SimianLuo/LCM_Dreamshaper_v7",
|
39 |
-
|
40 |
-
|
41 |
|
42 |
}
|
43 |
API_URL = model_urls[model_choice]
|
@@ -72,13 +70,13 @@ button {color: white; background-color: #106BA3; border: none; border-radius: 5p
|
|
72 |
|
73 |
# Define interface
|
74 |
title = "نموذج توليد الصور"
|
75 |
-
description = "اكتب وصف للصورة التي تود من النظام التوليدي
|
76 |
iface = gr.Interface(
|
77 |
fn=generate_image,
|
78 |
inputs=[
|
79 |
gr.components.Textbox(lines=2, placeholder="Enter the description of the image here..."),
|
80 |
gr.components.Dropdown(choices=["Stable Diffusion v1.5","dalle-3-xl-v2","midjourney-v6","openjourney-v4","LCM_Dreamshaper_v7"], label="Choose Model", value='Stable Diffusion v1.5'),
|
81 |
-
|
82 |
],
|
83 |
outputs=gr.components.Image(),
|
84 |
title=title,
|
@@ -86,5 +84,5 @@ iface = gr.Interface(
|
|
86 |
theme="default",
|
87 |
css=css
|
88 |
)
|
89 |
-
|
90 |
iface.launch()
|
|
|
31 |
if translate:
|
32 |
prompt = translate_text(prompt, target_language='en') # Assuming you want to translate to English
|
33 |
model_urls = {
|
34 |
+
"Stable Diffusion v1.5": "https://api-inference.huggingface.co/models/runwayml/stable-diffusion-v1-5",
|
35 |
"dalle-3-xl-v2": "https://api-inference.huggingface.co/models/ehristoforu/dalle-3-xl-v2",
|
36 |
"midjourney-v6": "https://api-inference.huggingface.co/models/Kvikontent/midjourney-v6",
|
37 |
"openjourney-v4": "https://api-inference.huggingface.co/models/prompthero/openjourney-v4",
|
38 |
"LCM_Dreamshaper_v7": "https://api-inference.huggingface.co/models/SimianLuo/LCM_Dreamshaper_v7",
|
|
|
|
|
39 |
|
40 |
}
|
41 |
API_URL = model_urls[model_choice]
|
|
|
70 |
|
71 |
# Define interface
|
72 |
title = "نموذج توليد الصور"
|
73 |
+
description = "اكتب وصف للصورة التي تود من النظام التوليدي انشاءها. على سبيل المثال: 'قطة ترتدي قبعة في مشهد شتوي'."
|
74 |
iface = gr.Interface(
|
75 |
fn=generate_image,
|
76 |
inputs=[
|
77 |
gr.components.Textbox(lines=2, placeholder="Enter the description of the image here..."),
|
78 |
gr.components.Dropdown(choices=["Stable Diffusion v1.5","dalle-3-xl-v2","midjourney-v6","openjourney-v4","LCM_Dreamshaper_v7"], label="Choose Model", value='Stable Diffusion v1.5'),
|
79 |
+
gr.components.Checkbox(label="Translate The Text Before Generating Image", value=False)
|
80 |
],
|
81 |
outputs=gr.components.Image(),
|
82 |
title=title,
|
|
|
84 |
theme="default",
|
85 |
css=css
|
86 |
)
|
87 |
+
# Launch the interface
|
88 |
iface.launch()
|