File size: 523 Bytes
f33e2be
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from fastapi import FastAPI
import subprocess  # Import subprocess module to run system commands
import ollama

app = FastAPI()

@app.get("/")
def read_root():
    return {"message": "Welcome to the Quantum-API/codelama"}

# Add other endpoints as needed for interacting with ollama
@app.get("/run-codelama")
def run_codelama():
    # You can call ollama commands here or use subprocess
    result = subprocess.run(["ollama", "run", "codellama:latest"], capture_output=True, text=True)
    return {"result": result.stdout}