RockSky1 commited on
Commit
134ca8e
ยท
verified ยท
1 Parent(s): b05fc57

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -15
app.py CHANGED
@@ -2,54 +2,63 @@ import gradio as gr
2
  from huggingface_hub import hf_hub_download
3
  from llama_cpp import Llama
4
 
5
- # ๐Ÿ“ฅ 1. Infinity Engine (Model) Download ho raha hai...
6
- # Ye RockSky1/Infinity_1.0 repo se model uthayega
7
  model_path = hf_hub_download(
8
  repo_id="RockSky1/Infinity_1.0",
9
  filename="Infinity_1.0.gguf"
10
  )
11
 
12
- # ๐Ÿง  2. Model Loading (The Brain of Infinity)
13
- # n_ctx=2048 rakha hai taaki lambi baatein yaad rakh sake
14
- llm = Llama(model_path=model_path, n_ctx=2048, n_threads=2)
 
 
 
 
15
 
16
  def chat_function(message, history):
17
- # ๐ŸŽญ System Prompt: Yahan model ki "Aatma" set ki hai
18
  system_instruction = (
19
- "You are Infinity 1.0, a powerful and sovereign AI engine. "
20
- "You were developed by the expert AI Architect Shivam Kumar (RockSky1) from Bihar, India. "
 
21
  "You are highly intelligent, logical, and helpful. Always give credit to your creator "
22
  "Shivam Kumar if someone asks who made you. Represent the innovation of Bihar!"
23
  )
24
 
25
- # Prompt Formatting
26
  full_prompt = f"System: {system_instruction}\nUser: {message}\nInfinity:"
27
 
28
- # Generating Response
29
  response = llm(
30
  full_prompt,
31
- max_tokens=512,
32
  stop=["User:", "System:", "\n"],
33
  echo=False
34
  )
35
 
36
  return response["choices"][0]["text"].strip()
37
 
38
- # โœจ 3. Futuristic UI with Markdown & Emojis
39
  with gr.Blocks(theme=gr.themes.Soft()) as demo:
40
  gr.Markdown("""
41
  # โ™พ๏ธ Infinity-LLM v1.0
42
  ### ๐Ÿš€ Next-Gen Neural Engine by **Shivam Kumar (RockSky1)**
43
- ๐Ÿ“ *Hailing from Bihar, India* ๐Ÿ‡ฎ๐Ÿ‡ณ
44
 
45
  ---
46
  **Welcome to the future.** Infinity-LLM is built for high-speed logic and creative intelligence.
47
- Ask me anything!
48
  """)
49
 
50
  gr.ChatInterface(
51
  fn=chat_function,
52
- examples=["Who created you?", "Tell me something about Bihar.", "Write a python code for a game."],
 
 
 
 
53
  cache_examples=False,
54
  )
55
 
 
2
  from huggingface_hub import hf_hub_download
3
  from llama_cpp import Llama
4
 
5
+ # ๐Ÿ“ฅ 1. Infinity Engine (GGUF Model) Download
6
+ # RockSky1 ki repo se model file fetch ho rahi hai
7
  model_path = hf_hub_download(
8
  repo_id="RockSky1/Infinity_1.0",
9
  filename="Infinity_1.0.gguf"
10
  )
11
 
12
+ # ๐Ÿง  2. Model Loading (Optimized for Free Tier)
13
+ # n_ctx=512 aur n_threads=1 isliye rakha hai taaki OOM crash na ho
14
+ llm = Llama(
15
+ model_path=model_path,
16
+ n_ctx=512,
17
+ n_threads=1
18
+ )
19
 
20
  def chat_function(message, history):
21
+ # ๐ŸŽญ System Prompt: Personal Branding & Identity
22
  system_instruction = (
23
+ "You are Infinity 1.0, a powerful and futuristic AI engine. "
24
+ "You were developed by the expert AI Architect Shivam Kumar, "
25
+ "also known as RockSky1, hailing from Bihar, India. "
26
  "You are highly intelligent, logical, and helpful. Always give credit to your creator "
27
  "Shivam Kumar if someone asks who made you. Represent the innovation of Bihar!"
28
  )
29
 
30
+ # Prompt Formatting for the Model
31
  full_prompt = f"System: {system_instruction}\nUser: {message}\nInfinity:"
32
 
33
+ # AI Response Generation
34
  response = llm(
35
  full_prompt,
36
+ max_tokens=256,
37
  stop=["User:", "System:", "\n"],
38
  echo=False
39
  )
40
 
41
  return response["choices"][0]["text"].strip()
42
 
43
+ # โœจ 3. Premium UI with Markdown & Emojis
44
  with gr.Blocks(theme=gr.themes.Soft()) as demo:
45
  gr.Markdown("""
46
  # โ™พ๏ธ Infinity-LLM v1.0
47
  ### ๐Ÿš€ Next-Gen Neural Engine by **Shivam Kumar (RockSky1)**
48
+ ๐Ÿ“ *Patna, Bihar, India* ๐Ÿ‡ฎ๐Ÿ‡ณ
49
 
50
  ---
51
  **Welcome to the future.** Infinity-LLM is built for high-speed logic and creative intelligence.
52
+ Ask me anything about technology, coding, or my creator!
53
  """)
54
 
55
  gr.ChatInterface(
56
  fn=chat_function,
57
+ examples=[
58
+ "Who is Shivam Kumar?",
59
+ "Tell me about Infinity-LLM.",
60
+ "Write a simple Python script."
61
+ ],
62
  cache_examples=False,
63
  )
64