majedk01 commited on
Commit
adde115
1 Parent(s): afa0fd4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -27,9 +27,9 @@ def query(payload, API_URL, headers):
27
  return response.content
28
 
29
  # Function to generate images based on prompts using the Hugging Face API
30
- def generate_image(prompt, model_choice):
31
-
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",
@@ -78,7 +78,7 @@ iface = gr.Interface(
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
- gr.components.Checkbox(label="Translate The Text Before Generating Image", value=False)
82
  ],
83
  outputs=gr.components.Image(),
84
  title=title,
 
27
  return response.content
28
 
29
  # Function to generate images based on prompts using the Hugging Face API
30
+ 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
  "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",
 
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,