| import os | |
| import subprocess | |
| import gradio as gr | |
| # Kompilasi C++ saat pertama kali dijalankan | |
| if not os.path.exists("jellyfishnet"): | |
| os.system("g++ infer.cpp -o jellyfishnet") | |
| def run_cpp(prompt): | |
| result = subprocess.run( | |
| ["./jellyfishnet"], | |
| input=prompt.encode(), | |
| stdout=subprocess.PIPE, | |
| stderr=subprocess.PIPE | |
| ) | |
| return result.stdout.decode() | |
| gr.Interface(fn=run_cpp, inputs="text", outputs="text", title="JellyfishNet 🪼").launch() | |