Spaces:
Running
Running
import subprocess | |
import gradio as gr | |
# Compile the model using "!make runfast" | |
try: | |
subprocess.run(["make", "runfast"], check=True, shell=True) | |
print("Model compilation successful.") | |
except subprocess.CalledProcessError as e: | |
print("Error:", e) | |
print(e.stderr) | |
def chatbot(prompt): | |
import subprocess | |
command = ["./run", "stories15M.bin", "-t", "0.8", "-p", "0.9", "-n", "256", "-i", f'"{prompt}"'] | |
try: | |
result = subprocess.run(command, capture_output=True, text=True, check=True, shell=False) | |
response = result.stdout | |
except subprocess.CalledProcessError as e: | |
response = "Error occurred while processing the request." | |
return response | |
iface = gr.Interface(fn=chatbot, inputs="text", outputs="text", live=True) | |
iface.launch() | |