charliebaby2023 commited on
Commit
1a0c870
Β·
verified Β·
1 Parent(s): ea546ce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -76,7 +76,6 @@ def gen_fn(model_str, prompt, negative_prompt):
76
  #image_response = models_load[model_str](f'{prompt} {negative_prompt} {noise}')
77
  print(f"77 {models_load[model_str](f'{combined_prompt}')}")
78
  image_response = models_load[model_str](f'{combined_prompt}')
79
- print(f"{image_response}")
80
  # Check if the image_response is a tuple, handle accordingly
81
  # if isinstance(image_response, tuple):
82
  # print(f"{image_response}")
@@ -86,11 +85,11 @@ def gen_fn(model_str, prompt, negative_prompt):
86
  # Ensure the response is an image or image-like object
87
  if isinstance(image_response, gr.Image):
88
  return image_response
89
- elif isinstance(image_response, str): # If the response is a path or URL, pass it as a string
90
- return gr.Image(image_response) # You can handle it based on your model's return type
91
- else:
92
- print(f"Unexpected response type: {type(image_response)}")
93
- return None
94
  except Exception as e:
95
  print(f"Error occurred: {e}")
96
  return e
@@ -138,7 +137,7 @@ js_code = """
138
  window.scrollTo = function() {};};
139
  setTimeout(() => {
140
  window.scrollTo = originalScroll;
141
- }, 300000); // Restore scroll function after 3 seconds
142
  </script>
143
  """
144
 
 
76
  #image_response = models_load[model_str](f'{prompt} {negative_prompt} {noise}')
77
  print(f"77 {models_load[model_str](f'{combined_prompt}')}")
78
  image_response = models_load[model_str](f'{combined_prompt}')
 
79
  # Check if the image_response is a tuple, handle accordingly
80
  # if isinstance(image_response, tuple):
81
  # print(f"{image_response}")
 
85
  # Ensure the response is an image or image-like object
86
  if isinstance(image_response, gr.Image):
87
  return image_response
88
+ # elif isinstance(image_response, str): # If the response is a path or URL, pass it as a string
89
+ # return gr.Image(image_response) # You can handle it based on your model's return type
90
+ # else:
91
+ # print(f"Unexpected response type: {type(image_response)}")
92
+ # return None
93
  except Exception as e:
94
  print(f"Error occurred: {e}")
95
  return e
 
137
  window.scrollTo = function() {};};
138
  setTimeout(() => {
139
  window.scrollTo = originalScroll;
140
+ }, 1000); // Restore scroll function after 3 seconds
141
  </script>
142
  """
143