Arabic250 commited on
Commit
d6df91e
·
verified ·
1 Parent(s): e599e91

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +26 -0
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from llama_cpp import Llama
3
+ import os
4
+
5
+ # تحميل النموذج
6
+ print("Loading model...")
7
+ llm = Llama(
8
+ model_path="gemma-4-medical.gguf",
9
+ n_ctx=2048,
10
+ n_threads=2
11
+ )
12
+
13
+ def generate_response(message, history):
14
+ prompt = f"USER: {message}
15
+ ASSISTANT: "
16
+ response = llm(prompt, max_tokens=512, stop=["USER:"], echo=False)
17
+ return response["choices"][0]["text"]
18
+
19
+ demo = gr.ChatInterface(
20
+ fn=generate_response,
21
+ title="Gemma 4 Medical GGUF",
22
+ description="Powered by llama-cpp-python inside HF Spaces"
23
+ )
24
+
25
+ if __name__ == "__main__":
26
+ demo.launch()