File size: 917 Bytes
131b70c db122e7 dd9d11a 131b70c db122e7 131b70c db122e7 fef64a9 ab171e7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
import gradio as gr
import os
import json
import collections
from pyrebase import pyrebase
config = {
"apiKey": os.environ.get("key"),
"authDomain": os.environ.get("domain"),
"databaseURL": os.environ.get("url"),
"projectId": os.environ.get("id"),
"storageBucket": os.environ.get("st_bk"),
"messagingSenderId": os.environ.get("sn_id"),
"appId": os.environ.get("a_id")
}
app = pyrebase.initialize_app(config)
db = app.database()
def function(parameter, parameter2):
data = db.child("Musics").child(parameter).get()
data = data.val()
if isinstance(data, collections.OrderedDict):
data = json.dumps(data[parameter2])
return data
else:
return data
inputs = [
gr.inputs.Textbox(label="Textbox", type="text"),
gr.inputs.Textbox(label="Textbox2", type="text"),
]
iface = gr.Interface(fn=function, inputs=inputs, outputs="text")
iface.launch()
|