sam-785 commited on
Commit
809c1ae
·
verified ·
1 Parent(s): 706a8c2

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -53
app.py DELETED
@@ -1,53 +0,0 @@
1
- import gradio as gr
2
- from llama_cpp import Llama
3
-
4
- # Model setup
5
- # File ka naam 'ai.gguf' hona chahiye
6
- model_path = "ai.gguf"
7
-
8
- print("SAM AI is waking up...")
9
- llm = Llama(
10
- model_path=model_path,
11
- n_ctx=2048,
12
- n_threads=4,
13
- chat_format="gemma" # Gemma 2.2B ke liye
14
- )
15
-
16
- def sam_chat(message, history):
17
- messages = []
18
- for human, assistant in history:
19
- messages.append({"role": "user", "content": human})
20
- messages.append({"role": "assistant", "content": assistant})
21
-
22
- messages.append({"role": "user", "content": message})
23
-
24
- response = llm.create_chat_completion(
25
- messages=messages,
26
- max_tokens=1024,
27
- stream=False
28
- )
29
- return response['choices'][0]['message']['content']
30
-
31
- # VIP UI Styling
32
- custom_css = """
33
- footer {visibility: hidden}
34
- .gradio-container {background-color: #f8f9fa;}
35
- #title-container {text-align: center; padding: 20px;}
36
- #title-container h1 {color: #1a1a1a; font-family: 'Inter', sans-serif;}
37
- .message-row.user {background-color: #007aff !important; color: white !important; border-radius: 15px 15px 0 15px !important;}
38
- .message-row.bot {background-color: #ffffff !important; border: 1px solid #e0e0e0 !important; border-radius: 15px 15px 15px 0 !important;}
39
- """
40
-
41
- with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as demo:
42
- with gr.Column(elem_id="title-container"):
43
- gr.Markdown("# 💎 SAM INTERNATIONAL AI")
44
- gr.Markdown("### Developed by Samahir Studio Production")
45
-
46
- chat = gr.ChatInterface(
47
- fn=sam_chat,
48
- type="messages",
49
- examples=["Hello SAM, tell me about your VIP skills", "Write a Python script for web scraping"],
50
- )
51
-
52
- if __name__ == "__main__":
53
- demo.launch(server_name="0.0.0.0", server_port=7860)