File size: 1,010 Bytes
710136b
1050dd5
5d147ec
 
710136b
 
 
 
 
 
 
 
 
 
 
5d147ec
710136b
 
1050dd5
710136b
 
 
 
 
1050dd5
710136b
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import subprocess
import os
import gradio as gr

# Step 1: Clone the GitHub repository and install requirements
if not os.path.exists("project"):
    subprocess.run(["git", "clone", "https://github.com/luisesantillan/project"])
    subprocess.run(["pip", "install", "-r", "project/requirements.txt"])
    subprocess.run(["python", "project/download_files.py"])

# Step 2: Change directory to the project folder
os.chdir("project")

# Step 3: Start TensorBoard (if required)
tensorboard = True  # Change this to False if you don't want to use TensorBoard

if tensorboard:
    subprocess.Popen(["tensorboard", "--logdir", "./logs"])

# Step 4: Start the Gradio app
def gradio_app(input_text):
    # Step 5: Run the app.py script with input_text as an argument
    result = subprocess.run(["python", "app.py", "--colab", input_text], capture_output=True, text=True)
    return result.stdout

# Create a Gradio interface
iface = gr.Interface(fn=gradio_app, inputs="text", outputs="text", live=True)
iface.launch()