emeses commited on
Commit
90a6c56
·
1 Parent(s): 3e82991

Update space

Browse files
Files changed (1) hide show
  1. app.py +4 -9
app.py CHANGED
@@ -1,10 +1,8 @@
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
 
4
- """
5
- For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
6
- """
7
- client = InferenceClient("unsloth/Llama-3.2-3B-Instruct")
8
 
9
 
10
  def respond(
@@ -27,6 +25,7 @@ def respond(
27
 
28
  response = ""
29
 
 
30
  for message in client.chat_completion(
31
  messages,
32
  max_tokens=max_tokens,
@@ -35,14 +34,11 @@ def respond(
35
  top_p=top_p,
36
  ):
37
  token = message.choices[0].delta.content
38
-
39
  response += token
40
  yield response
41
 
42
 
43
- """
44
- For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
45
- """
46
  demo = gr.ChatInterface(
47
  respond,
48
  additional_inputs=[
@@ -59,6 +55,5 @@ demo = gr.ChatInterface(
59
  ],
60
  )
61
 
62
-
63
  if __name__ == "__main__":
64
  demo.launch()
 
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
 
4
+ # Replace with your fine-tuned model endpoint
5
+ client = InferenceClient("emeses/lab2_model")
 
 
6
 
7
 
8
  def respond(
 
25
 
26
  response = ""
27
 
28
+ # Stream tokens from the model response
29
  for message in client.chat_completion(
30
  messages,
31
  max_tokens=max_tokens,
 
34
  top_p=top_p,
35
  ):
36
  token = message.choices[0].delta.content
 
37
  response += token
38
  yield response
39
 
40
 
41
+ # Gradio interface
 
 
42
  demo = gr.ChatInterface(
43
  respond,
44
  additional_inputs=[
 
55
  ],
56
  )
57
 
 
58
  if __name__ == "__main__":
59
  demo.launch()