OPtimusPrimeSkibidi commited on
Commit
193aa50
·
verified ·
1 Parent(s): a9ba985

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -16
app.py CHANGED
@@ -1,32 +1,30 @@
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
 
4
- # Use HF's inference API - no local model needed!
5
- client = InferenceClient(
6
- model="bartowski/p-e-w_Qwen3-4B-Instruct-2507-heretic-GGUF"
7
- )
8
 
9
  def chat(message, history):
10
- # Build conversation from history
11
  messages = []
12
  for human, assistant in history:
13
  messages.append({"role": "user", "content": human})
14
  messages.append({"role": "assistant", "content": assistant})
15
  messages.append({"role": "user", "content": message})
16
 
17
- # Stream the response
18
  response = ""
19
- for chunk in client.chat_completion(
20
- messages=messages,
21
- max_tokens=512,
22
- temperature=0.7,
23
- stream=True
24
- ):
25
- if chunk.choices[0].delta.content:
26
- response += chunk.choices[0].delta.content
27
- yield response
 
 
 
28
 
29
- # Create the chat interface
30
  demo = gr.ChatInterface(
31
  chat,
32
  type="messages",
 
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
 
4
+ # Use the uncensored Llama model
5
+ client = InferenceClient(model="Orenguteng/Llama-3-8B-Lexi-Uncensored")
 
 
6
 
7
  def chat(message, history):
 
8
  messages = []
9
  for human, assistant in history:
10
  messages.append({"role": "user", "content": human})
11
  messages.append({"role": "assistant", "content": assistant})
12
  messages.append({"role": "user", "content": message})
13
 
 
14
  response = ""
15
+ try:
16
+ for chunk in client.chat_completion(
17
+ messages=messages,
18
+ max_tokens=512,
19
+ temperature=0.7,
20
+ stream=True
21
+ ):
22
+ if chunk.choices[0].delta.content:
23
+ response += chunk.choices[0].delta.content
24
+ yield response
25
+ except Exception as e:
26
+ yield f"Error: {str(e)}"
27
 
 
28
  demo = gr.ChatInterface(
29
  chat,
30
  type="messages",