measmonysuon commited on
Commit
0d23f2b
1 Parent(s): 5533905

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -19
app.py CHANGED
@@ -131,29 +131,12 @@ def handle_generate_image(prompt, resolution_key, user_chat_id):
131
  result = gradio_interface(prompt, resolution_key, user_chat_id)
132
  if result[0]:
133
  # Include the GPU info in the success message
134
- gpu_info = result[1] # Assuming gradio_interface returns GPU info in the second part of the tuple
135
- return result[0], f"Check your telegram, The image was generated successfully. {gpu_info}"
136
 
137
  return None, "There was an error processing your photo. Please try again later."
138
 
139
  return None, "Insufficient points. Please get more points before generating an image."
140
-
141
- def get_gpu_info():
142
- if torch.cuda.is_available():
143
- device_name = torch.cuda.get_device_name(0)
144
- device_properties = torch.cuda.get_device_properties(0)
145
- total_memory = f"{device_properties.total_memory // (1024 ** 2)} MB"
146
- return {
147
- 'is_cuda_available': True,
148
- 'device_name': device_name,
149
- 'total_memory': total_memory
150
- }
151
- else:
152
- return {
153
- 'is_cuda_available': False,
154
- 'device_name': 'N/A',
155
- 'total_memory': 'N/A'
156
- }
157
 
158
  def request_otp(user_chat_id):
159
  try:
 
131
  result = gradio_interface(prompt, resolution_key, user_chat_id)
132
  if result[0]:
133
  # Include the GPU info in the success message
134
+ full_file_url, gpu_info = result
135
+ return full_file_url, f"Check your telegram, The image was generated successfully. GPU Info: {json.dumps(gpu_info)}"
136
 
137
  return None, "There was an error processing your photo. Please try again later."
138
 
139
  return None, "Insufficient points. Please get more points before generating an image."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
 
141
  def request_otp(user_chat_id):
142
  try: