SimBombeRino commited on
Commit
c59570e
·
verified ·
1 Parent(s): 7aebf9d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -1,24 +1,23 @@
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
 
4
- # Initialize the client with timeout
5
  client = InferenceClient("unsloth/llama-3.2-3b-instruct-bnb-4bit", timeout=30)
6
-
7
  def respond(message, max_tokens, temperature, top_p):
8
  response = ""
9
 
10
  # Use the text generation API
11
  for message in client.text_generation(
12
- inputs=message,
13
- max_new_tokens=max_tokens,
14
- temperature=temperature,
15
- top_p=top_p,
16
  stream=True
17
  ):
18
  token = message["generated_text"]
19
  response += token
20
  yield response
21
 
 
22
  # Create Gradio Interface
23
  demo = gr.Interface(
24
  fn=respond,
 
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
 
 
4
  client = InferenceClient("unsloth/llama-3.2-3b-instruct-bnb-4bit", timeout=30)
 
5
  def respond(message, max_tokens, temperature, top_p):
6
  response = ""
7
 
8
  # Use the text generation API
9
  for message in client.text_generation(
10
+ message,
11
+ max_new_tokens=max_tokens,
12
+ temperature=temperature,
13
+ top_p=top_p,
14
  stream=True
15
  ):
16
  token = message["generated_text"]
17
  response += token
18
  yield response
19
 
20
+
21
  # Create Gradio Interface
22
  demo = gr.Interface(
23
  fn=respond,