play_with_baby_llama2 / import subprocess.py
Ritori's picture
Upload folder using huggingface_hub
613e5d1
raw
history blame contribute delete
754 Bytes
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)