tts_labeling / app.py
Navid Arabi
test mysql
ac40033
raw
history blame
895 Bytes
import mysql.connector
from mysql.connector import Error
config = {
"host": "annotation-db.apps.teh2.abrhapaas.com",
"user": "navid",
"password": "ZUJSK!1V!PF4ZEnIaylX",
"charset": "utf8mb4",
"port": 32107,
"use_unicode": True
}
import gradio as gr
def greet(name):
try:
conn = mysql.connector.connect(**config)
if conn.is_connected():
cursor = conn.cursor()
cursor.execute("SELECT VERSION()")
version = cursor.fetchone()
return f"🟢 MySQL Server Version: {version[0]}"
except Error as e:
return f"❌ error: {e}"
finally:
if 'cursor' in locals():
cursor.close()
if 'conn' in locals() and conn.is_connected():
conn.close()
print("⛔️Closed.")
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
demo.launch()