File size: 754 Bytes
613e5d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
30
import subprocess

# Define the command as a list
import gradio as gr

def generate_text():

    
    cmd = ['./run', 'model.bin']

    # Use subprocess.run to execute the command
    result = subprocess.run(cmd, stdout=subprocess.PIPE, text=True)
    # 在这里运行你的模型,生成文本
    # 以下是一个示例
    text = "这是生成的文本。"
    title="运行来让小羊驼跑起来"
    return result

iface = gr.Interface(fn=generate_text, inputs=[], outputs="text",submit_label="让小羊驼跑起来",title="和小羊驼一起玩")
iface.launch()


cmd = ['./run', 'model.bin']

# Use subprocess.run to execute the command
result = subprocess.run(cmd, stdout=subprocess.PIPE, text=True)

# Print the output
print(result.stdout)