Spaces:
Runtime error
Runtime error
Rename run_ollama,py to start_ollama_server,py
Browse files- run_ollama,py +0 -16
- start_ollama_server,py +11 -0
run_ollama,py
DELETED
@@ -1,16 +0,0 @@
|
|
1 |
-
import ollama
|
2 |
-
from huggingface_hub import login
|
3 |
-
|
4 |
-
def run_ollama(prompt,token=""):
|
5 |
-
# Login to Hugging Face
|
6 |
-
login(token=token)
|
7 |
-
|
8 |
-
# Load and run the model
|
9 |
-
model = ollama.load_model("tiny_llama")
|
10 |
-
response = model.run("Why is the sky blue")
|
11 |
-
print(response)
|
12 |
-
return response
|
13 |
-
|
14 |
-
if __name__ == "__main__":
|
15 |
-
response = run_ollama()
|
16 |
-
print(response)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
start_ollama_server,py
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import ollama
|
2 |
+
import time
|
3 |
+
|
4 |
+
# Configure the Ollama server
|
5 |
+
ollama.setup(host="0.0.0.0", port=8000)
|
6 |
+
|
7 |
+
# Start the Ollama server
|
8 |
+
ollama.start()
|
9 |
+
|
10 |
+
# Wait for the server to be ready
|
11 |
+
time.sleep(10) # Adjust the sleep duration as necessary
|