Spaces:
Paused
Paused
Update main.py
Browse files
main.py
CHANGED
|
@@ -1,30 +1,33 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import
|
| 3 |
-
import
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
return
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
def run():
|
| 20 |
-
|
| 21 |
-
fn=
|
| 22 |
-
inputs=
|
| 23 |
-
outputs=
|
|
|
|
|
|
|
| 24 |
)
|
| 25 |
-
|
| 26 |
-
demo.launch(server_name="0.0.0.0", server_port=7860)
|
| 27 |
-
|
| 28 |
|
| 29 |
if __name__ == "__main__":
|
| 30 |
run()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import os
|
| 3 |
+
import subprocess
|
| 4 |
+
|
| 5 |
+
def install_server():
|
| 6 |
+
output = ""
|
| 7 |
+
try:
|
| 8 |
+
os.mkdir("milvus_compose")
|
| 9 |
+
output += "Created directory 'milvus_compose'\n"
|
| 10 |
+
subprocess.run(["wget", "https://github.com/milvus-io/milvus/releases/download/v2.3.0-beta/milvus-standalone-docker-compose.yml", "-O", "milvus_compose/docker-compose.yml"], check=True)
|
| 11 |
+
output += "Downloaded 'docker-compose.yml'\n"
|
| 12 |
+
#subprocess.run(["docker-compose", "up", "-d"], check=True)
|
| 13 |
+
#output += "Started Milvus server\n"
|
| 14 |
+
except Exception as e:
|
| 15 |
+
output += str(e)
|
| 16 |
+
return output
|
| 17 |
+
|
| 18 |
+
def list_files():
|
| 19 |
+
files = os.listdir('.')
|
| 20 |
+
return files
|
| 21 |
|
| 22 |
def run():
|
| 23 |
+
iface = gr.Interface(
|
| 24 |
+
fn=[install_server, list_files],
|
| 25 |
+
inputs=None,
|
| 26 |
+
outputs=["text", "text"],
|
| 27 |
+
layout="horizontal",
|
| 28 |
+
title="Milvus Server Installation"
|
| 29 |
)
|
| 30 |
+
iface.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
|
|
|
| 31 |
|
| 32 |
if __name__ == "__main__":
|
| 33 |
run()
|