File size: 904 Bytes
dc96aa4
f335863
99d0125
 
fa7383f
dc96aa4
 
fa7383f
 
dc96aa4
 
 
 
f335863
 
 
956e575
2c0b50b
f335863
 
956e575
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
from flask import Flask
from gradio_client import Client
import time
from multiprocessing import Process
from flask_cors import CORS, cross_origin

app = Flask(__name__)
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'

@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(
		"You are AmeuChat, a helpful intelligent bot created by Rupnil Mondal. You were created in Rupnil's Computer." + query,	# str  in 'Message' Textbox component
		api_name = "/chat"
	)

    return result

def record_loop():
   while True:
        print("loop running")
        time.sleep(5)


if __name__ == "__main__":
   p = Process(target=record_loop)
   p.start()  
   app.run(debug=True, use_reloader=False)
   p.join()