razaali10's picture
Upload folder using huggingface_hub
fda6129 verified
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)