kwabs22
commited on
Commit
·
5dd2646
1
Parent(s):
49ae654
Cpp to python, Testing Stable LM 2 1.6B Zephyr
Browse files
app.py
CHANGED
@@ -38,7 +38,6 @@ def generate_response(user_message):
|
|
38 |
"""
|
39 |
|
40 |
def generate_response(user_message):
|
41 |
-
print("Before request")
|
42 |
cmd = [
|
43 |
"/app/llama.cpp/main", # Path to the executable
|
44 |
"-m", "/app/llama.cpp/models/stablelm-2-zephyr-1_6b-Q4_0.gguf",
|
@@ -46,13 +45,17 @@ def generate_response(user_message):
|
|
46 |
"-n", "400",
|
47 |
"-e"
|
48 |
]
|
49 |
-
|
|
|
50 |
# Start the subprocess
|
51 |
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
52 |
|
|
|
|
|
53 |
# Yield each line of output as it becomes available
|
54 |
for line in process.stdout:
|
55 |
-
|
|
|
56 |
|
57 |
# Wait for the subprocess to finish if it hasn't already
|
58 |
process.wait()
|
|
|
38 |
"""
|
39 |
|
40 |
def generate_response(user_message):
|
|
|
41 |
cmd = [
|
42 |
"/app/llama.cpp/main", # Path to the executable
|
43 |
"-m", "/app/llama.cpp/models/stablelm-2-zephyr-1_6b-Q4_0.gguf",
|
|
|
45 |
"-n", "400",
|
46 |
"-e"
|
47 |
]
|
48 |
+
|
49 |
+
print("Before request")
|
50 |
# Start the subprocess
|
51 |
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
52 |
|
53 |
+
alllines = ""
|
54 |
+
|
55 |
# Yield each line of output as it becomes available
|
56 |
for line in process.stdout:
|
57 |
+
alllines += " " + line
|
58 |
+
yield alllines
|
59 |
|
60 |
# Wait for the subprocess to finish if it hasn't already
|
61 |
process.wait()
|