Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -72,7 +72,10 @@ def init():
|
|
72 |
INIT_SIGN = "FINISHED"
|
73 |
|
74 |
def ollama_func(command):
|
75 |
-
|
|
|
|
|
|
|
76 |
function_map = {
|
77 |
"/init": init(),
|
78 |
"/pull": ollama.pull(c2),
|
@@ -81,8 +84,9 @@ def ollama_func(command):
|
|
81 |
}
|
82 |
if c1 in function_map:
|
83 |
function_map[c1]
|
|
|
84 |
else:
|
85 |
-
|
86 |
|
87 |
@spaces.GPU()
|
88 |
def launch():
|
@@ -96,7 +100,7 @@ def stream_chat(message: str, history: list, model: str, temperature: float, max
|
|
96 |
ollama_func(message)
|
97 |
else:
|
98 |
if not INIT_SIGN:
|
99 |
-
return "Please Enter /init to initialize Ollama"
|
100 |
else:
|
101 |
launch()
|
102 |
conversation = []
|
|
|
72 |
INIT_SIGN = "FINISHED"
|
73 |
|
74 |
def ollama_func(command):
|
75 |
+
if " " in command:
|
76 |
+
c1, c2 = command.split(" ")
|
77 |
+
else:
|
78 |
+
c1 = command
|
79 |
function_map = {
|
80 |
"/init": init(),
|
81 |
"/pull": ollama.pull(c2),
|
|
|
84 |
}
|
85 |
if c1 in function_map:
|
86 |
function_map[c1]
|
87 |
+
return [f"Running {function_map[c1]}"]
|
88 |
else:
|
89 |
+
return ["No supported command."]
|
90 |
|
91 |
@spaces.GPU()
|
92 |
def launch():
|
|
|
100 |
ollama_func(message)
|
101 |
else:
|
102 |
if not INIT_SIGN:
|
103 |
+
return ["Please Enter /init to initialize Ollama"]
|
104 |
else:
|
105 |
launch()
|
106 |
conversation = []
|