aibmedia commited on
Commit
0ff8527
·
verified ·
1 Parent(s): 1c76c88

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +12 -3
main.py CHANGED
@@ -1,20 +1,29 @@
1
- import subprocess
 
2
 
3
  from flask import Flask
 
 
4
  app = Flask(__name__)
5
 
6
  def run_command():
7
- return subprocess.Popen("./mxbai-embed-large-v1-f16.llamafile --server --nobrowser", shell=False, stdout=subprocess.PIPE).stdout.read()
 
8
 
9
  @app.route('/app')
10
  def command_app():
11
  print(run_command())
 
 
 
12
  print("command run")
13
  return "hi"
14
 
15
  @app.route('/')
16
  def command_server():
17
-
 
 
18
  print("command run")
19
  return "hi"
20
 
 
1
+ import os
2
+ import asyncio
3
 
4
  from flask import Flask
5
+ import time
6
+
7
  app = Flask(__name__)
8
 
9
  def run_command():
10
+
11
+ return os.system("./mxbai-embed-large-v1-f16.llamafile --server --nobrowser")
12
 
13
  @app.route('/app')
14
  def command_app():
15
  print(run_command())
16
+ for x in range(1, 10):
17
+ print(x)
18
+ time.sleep(5)
19
  print("command run")
20
  return "hi"
21
 
22
  @app.route('/')
23
  def command_server():
24
+ loop = asyncio.get_event_loop()
25
+ loop.run_until_complete(command_app())
26
+ loop.close()
27
  print("command run")
28
  return "hi"
29