Spaces:
Runtime error
Runtime error
acecalisto3
commited on
Commit
•
04ebae0
1
Parent(s):
81ea255
Update app.py
Browse files
app.py
CHANGED
@@ -58,9 +58,13 @@ def get_db_connection():
|
|
58 |
) # Connect to the server first
|
59 |
|
60 |
# Select the database
|
61 |
-
|
62 |
-
|
63 |
-
|
|
|
|
|
|
|
|
|
64 |
|
65 |
return db_connection
|
66 |
except Exception as e:
|
@@ -345,7 +349,8 @@ with gr.Blocks() as demo:
|
|
345 |
def update_feed_content():
|
346 |
return generate_rss_feed()
|
347 |
|
348 |
-
|
|
|
349 |
|
350 |
if __name__ == "__main__":
|
351 |
-
demo.launch(
|
|
|
58 |
) # Connect to the server first
|
59 |
|
60 |
# Select the database
|
61 |
+
if DB_NAME:
|
62 |
+
cursor = db_connection.cursor()
|
63 |
+
cursor.execute(f"USE {DB_NAME}")
|
64 |
+
cursor.close()
|
65 |
+
else:
|
66 |
+
logging.error("Database name is not set.")
|
67 |
+
return None
|
68 |
|
69 |
return db_connection
|
70 |
except Exception as e:
|
|
|
349 |
def update_feed_content():
|
350 |
return generate_rss_feed()
|
351 |
|
352 |
+
# Use gr.Timer to periodically update the RSS feed content
|
353 |
+
gr.Timer(update_feed_content, every=5).start()
|
354 |
|
355 |
if __name__ == "__main__":
|
356 |
+
demo.launch()
|