import gradio as gr from llama_cpp import Llama # ✅ Update with your actual model path model_path = r"C:\Users\razaa\.cache\lm-studio\models\lmstudio-community\DeepSeek-R1-Distill-Llama-8B-GGUF\DeepSeek-R1-Distill-Llama-8B-Q4_K_M.gguf" # ✅ Load the model llm = Llama(model_path=model_path, n_ctx=2048) # ✅ Function to generate responses def generate_response(prompt): response = llm(prompt, max_tokens=256, temperature=0.7, top_p=0.9) return response['choices'][0]['text'] # ✅ Create Gradio UI demo = gr.Interface(fn=generate_response, inputs="text", outputs="text") # ✅ Make it accessible from the internet demo.launch(share=True)