Spaces:
Runtime error
Runtime error
| 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' | |
| def hello(): | |
| return '{"status": {"details": {"code": 200, "message": "working"}}}' | |
| 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() |