| import gradio as gr | |
| def greet(input_text): | |
| # Example call to a compiled llama.cpp binary (replace with real model path) | |
| # subprocess.run(["./llama.cpp/main", "-m", "models/llama-7b.gguf", "-p", input_text]) | |
| return f"Llama.cpp would process: {input_text}" | |
| def run(): | |
| demo = gr.Interface( | |
| fn=greet, | |
| inputs=gr.Textbox(label="Enter text"), | |
| outputs="text", | |
| title="Llama.cpp + Gradio Demo" | |
| ) | |
| demo.launch(server_name="0.0.0.0", server_port=7860) | |
| if __name__ == "__main__": | |
| run() |