measmonysuon commited on
Commit
19d1e42
1 Parent(s): 996bcaa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -4
app.py CHANGED
@@ -121,9 +121,18 @@ def gradio_interface(prompt, resolution_key, user_chat_id):
121
  def handle_generate_image(prompt, resolution_key, user_chat_id):
122
  points = get_user_points(user_chat_id)
123
 
124
- if points == "User not found":
125
- # If user is not found, update points_output with the registration message
126
- return None, "Please register with @myexpsupportBot"
 
 
 
 
 
 
 
 
 
127
 
128
  if points >= 5:
129
  result = gradio_interface(prompt, resolution_key, user_chat_id)
@@ -132,7 +141,7 @@ def handle_generate_image(prompt, resolution_key, user_chat_id):
132
  else:
133
  return None, "There was an error processing your photo. Please try again later."
134
  else:
135
- return None, "Insufficient points. Please get more points before generating an image."
136
 
137
 
138
  def create_gradio_interface():
 
121
  def handle_generate_image(prompt, resolution_key, user_chat_id):
122
  points = get_user_points(user_chat_id)
123
 
124
+ # Check if the points is a string indicating user not found
125
+ if isinstance(points, str):
126
+ if points == "User not found":
127
+ return None, "Please register with @myexpsupportBot"
128
+ else:
129
+ return None, "Error retrieving points. Please try again later."
130
+
131
+ # Ensure points is an integer
132
+ try:
133
+ points = int(points)
134
+ except ValueError:
135
+ return None, "Error processing points. Please try again later."
136
 
137
  if points >= 5:
138
  result = gradio_interface(prompt, resolution_key, user_chat_id)
 
141
  else:
142
  return None, "There was an error processing your photo. Please try again later."
143
  else:
144
+ return None, "Insufficient points. Please get more points before generating an image."
145
 
146
 
147
  def create_gradio_interface():