Spaces:
Runtime error
Runtime error
measmonysuon
commited on
Commit
•
d0c29e1
1
Parent(s):
ea489ba
Update app.py
Browse files
app.py
CHANGED
@@ -75,17 +75,6 @@ def notify_webhook(user_chat_id):
|
|
75 |
except requests.RequestException as e:
|
76 |
logger.error(f"Error sending webhook notification: {e}")
|
77 |
|
78 |
-
def get_user_points(user_chat_id):
|
79 |
-
"""Fetches user points from the database. Returns 'User not found' if the user is not in the database."""
|
80 |
-
with sqlite3.connect(db_path) as conn:
|
81 |
-
cursor = conn.cursor()
|
82 |
-
cursor.execute('SELECT points FROM users WHERE user_chat_id = ?', (user_chat_id,))
|
83 |
-
result = cursor.fetchone()
|
84 |
-
if result:
|
85 |
-
return result[0] # Return the points
|
86 |
-
else:
|
87 |
-
return "User not found" # Return an error message if user is not found
|
88 |
-
|
89 |
def extract_user_chat_id_from_url(url):
|
90 |
parsed_url = urlparse(url)
|
91 |
params = parse_qs(parsed_url.query)
|
@@ -153,7 +142,8 @@ def create_gradio_interface(user_chat_id):
|
|
153 |
with gr.Row():
|
154 |
user_chat_id_input
|
155 |
points_output
|
156 |
-
|
|
|
157 |
with gr.Row():
|
158 |
prompt_input
|
159 |
resolution_dropdown
|
|
|
75 |
except requests.RequestException as e:
|
76 |
logger.error(f"Error sending webhook notification: {e}")
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
def extract_user_chat_id_from_url(url):
|
79 |
parsed_url = urlparse(url)
|
80 |
params = parse_qs(parsed_url.query)
|
|
|
142 |
with gr.Row():
|
143 |
user_chat_id_input
|
144 |
points_output
|
145 |
+
get_points_button
|
146 |
+
|
147 |
with gr.Row():
|
148 |
prompt_input
|
149 |
resolution_dropdown
|