Rooni commited on
Commit
8e01f8a
·
verified ·
1 Parent(s): d0696ca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -4
app.py CHANGED
@@ -67,14 +67,17 @@ def process_image(
67
  with tempfile.NamedTemporaryFile(suffix=".png", delete=False) as temp_file:
68
  resized_image.save(temp_file.name)
69
  image_path = temp_file.name
 
70
  if model_choice != "Kolors":
71
- language = detect(prompt)
72
- if language != 'en':
73
- prompt = GoogleTranslator(source=language, target='en').translate(prompt)
74
-
75
  try:
76
  if model_choice == "Stable Diffusion":
77
  client = Client("InstantX/SD35-IP-Adapter", hf_token=api_key)
 
 
 
 
 
78
  result = client.predict(
79
  image=handle_file(image_path),
80
  prompt=prompt,
@@ -87,6 +90,11 @@ def process_image(
87
 
88
  elif model_choice == "Flux":
89
  client = Client("InstantX/flux-IP-adapter", hf_token=api_key)
 
 
 
 
 
90
  result = client.predict(
91
  image=handle_file(image_path),
92
  prompt=prompt,
@@ -99,6 +107,7 @@ def process_image(
99
 
100
  elif model_choice == "Kolors":
101
  client = Client("multimodalart/Kolors-IPAdapter", hf_token=api_key)
 
102
  language = detect(prompt_kolors)
103
  if language != 'en':
104
  prompt_kolors = GoogleTranslator(source=language, target='en').translate(prompt_kolors)
 
67
  with tempfile.NamedTemporaryFile(suffix=".png", delete=False) as temp_file:
68
  resized_image.save(temp_file.name)
69
  image_path = temp_file.name
70
+
71
  if model_choice != "Kolors":
72
+
 
 
 
73
  try:
74
  if model_choice == "Stable Diffusion":
75
  client = Client("InstantX/SD35-IP-Adapter", hf_token=api_key)
76
+
77
+ language = detect(prompt)
78
+ if language != 'en':
79
+ prompt = GoogleTranslator(source=language, target='en').translate(prompt)
80
+
81
  result = client.predict(
82
  image=handle_file(image_path),
83
  prompt=prompt,
 
90
 
91
  elif model_choice == "Flux":
92
  client = Client("InstantX/flux-IP-adapter", hf_token=api_key)
93
+
94
+ language = detect(prompt)
95
+ if language != 'en':
96
+ prompt = GoogleTranslator(source=language, target='en').translate(prompt)
97
+
98
  result = client.predict(
99
  image=handle_file(image_path),
100
  prompt=prompt,
 
107
 
108
  elif model_choice == "Kolors":
109
  client = Client("multimodalart/Kolors-IPAdapter", hf_token=api_key)
110
+
111
  language = detect(prompt_kolors)
112
  if language != 'en':
113
  prompt_kolors = GoogleTranslator(source=language, target='en').translate(prompt_kolors)