xTHExBEASTx commited on
Commit
d04104a
·
verified ·
1 Parent(s): 9c6c21b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -8
app.py CHANGED
@@ -1,24 +1,23 @@
1
- import os
2
  import subprocess
3
  import time
4
- from fastapi import FastAPI
5
  import uvicorn
 
6
 
7
  app = FastAPI()
8
 
9
  @app.get("/")
10
- def home():
11
- return {"status": "Ollama is running", "model": "qwen2.5-coder:7b"}
12
 
13
  if __name__ == "__main__":
14
- # Start Ollama in the background
15
  subprocess.Popen(["ollama", "serve"])
16
 
17
- # Wait for Ollama to wake up
18
  time.sleep(5)
19
 
20
- # Ensure our model is pulled
21
  subprocess.run(["ollama", "pull", "qwen2.5-coder:7b"])
22
 
23
- # Start the web server on port 7860 for Hugging Face
24
  uvicorn.run(app, host="0.0.0.0", port=7860)
 
 
1
  import subprocess
2
  import time
 
3
  import uvicorn
4
+ from fastapi import FastAPI
5
 
6
  app = FastAPI()
7
 
8
  @app.get("/")
9
+ def read_root():
10
+ return {"message": "Ollama Server is Live"}
11
 
12
  if __name__ == "__main__":
13
+ # Start the Ollama engine in the background
14
  subprocess.Popen(["ollama", "serve"])
15
 
16
+ # Wait for the engine to initialize
17
  time.sleep(5)
18
 
19
+ # Ensure your specific model is pulled
20
  subprocess.run(["ollama", "pull", "qwen2.5-coder:7b"])
21
 
22
+ # Start the web server that Hugging Face expects
23
  uvicorn.run(app, host="0.0.0.0", port=7860)