Spaces:
Sleeping
Sleeping
robert
commited on
Commit
·
ba33077
1
Parent(s):
e2f6cbd
Adding a subprocess to run the pip install
Browse files
app.py
CHANGED
@@ -1,7 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
|
|
3 |
def greet(name):
|
4 |
return "Hello " + name + "!!"
|
5 |
|
|
|
6 |
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
7 |
demo.launch()
|
|
|
1 |
+
import subprocess
|
2 |
+
import sys
|
3 |
+
|
4 |
+
|
5 |
+
def install_requirements(requirements_file="requirements.txt"):
|
6 |
+
try:
|
7 |
+
subprocess.check_call(
|
8 |
+
[sys.executable, "-m", "pip", "install", "-r", requirements_file]
|
9 |
+
)
|
10 |
+
except subprocess.CalledProcessError as e:
|
11 |
+
print(f"Failed to install packages from {requirements_file}: {e}")
|
12 |
+
|
13 |
+
|
14 |
import gradio as gr
|
15 |
|
16 |
+
|
17 |
def greet(name):
|
18 |
return "Hello " + name + "!!"
|
19 |
|
20 |
+
|
21 |
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
22 |
demo.launch()
|