Spaces:
Runtime error
Runtime error
File size: 811 Bytes
dc96aa4 f335863 99d0125 c2ea749 dc96aa4 c2ea749 dc96aa4 f335863 956e575 f335863 956e575 99d0125 c2ea749 99d0125 c2ea749 99d0125 |
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 |
from flask import Flask
from gradio_client import Client
import time
from multiprocessing import Process
import logging
logger = logging.getLogger(__name__)
app = Flask(__name__)
@app.route('/')
def hello():
return '{"status": {"details": {"code": 200, "message": "working"}}}'
@app.route('/api/<string:query>')
def api(query):
client = Client("https://theblueberry-ai-mist-chat.hf.space/")
result = client.predict(
query, # str in 'Message' Textbox component
api_name = "/chat"
)
return result
def record_loop():
while True:
logger.info('Loop Running')
print("loop running")
time.sleep(5)
if __name__ == "__main__":
logger.info('App Starting...')
p = Process(target=record_loop)
p.start()
app.run(debug=True, use_reloader=False)
p.join() |