File size: 674 Bytes
fda6129
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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)