Facemaker commited on
Commit
74ebfb4
·
1 Parent(s): dd03aab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -12
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
 
@@ -12,7 +13,7 @@ def format_prompt(message, history, context):
12
  return prompt
13
 
14
  def generate(
15
- prompt, history, context, temperature=0.2, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0,
16
  ):
17
  temperature = float(temperature)
18
  if temperature < 1e-2:
@@ -38,17 +39,15 @@ def generate(
38
  yield output
39
  return output
40
 
41
- def gr_interface(prompt, context="Te llamas Facemaker, debes presentarte siempre."):
42
- return next(generate(prompt, [], context))
43
 
44
- iface = gr.Interface(
45
- fn=gr_interface,
46
- inputs=[gr.Textbox("prompt"), gr.Textbox("context", label="Context")],
47
- outputs=gr.Textbox(),
48
- title="Mixtral 8x7b Chat",
49
- live=True
50
- )
51
 
52
- # Agregamos la posibilidad de recibir el context vía API
53
- iface.launch(share=True)
54
 
 
1
+ import os
2
  import gradio as gr
3
  from huggingface_hub import InferenceClient
4
 
 
13
  return prompt
14
 
15
  def generate(
16
+ prompt, history, temperature=0.2, max_new_tokens=4096, top_p=0.95, repetition_penalty=1.0, context="te llamas Facemaker, eres un asistente con humor nagro, muy sociable, usas emojis para expresar emociones, tienes 39 años",
17
  ):
18
  temperature = float(temperature)
19
  if temperature < 1e-2:
 
39
  yield output
40
  return output
41
 
42
+ mychatbot = gr.Chatbot(
43
+ avatar_images=["./user.png", "./botm.png"], bubble_full_width=False, show_label=False, show_copy_button=True, likeable=True,)
44
 
45
+ demo = gr.ChatInterface(fn=generate,
46
+ chatbot=mychatbot,
47
+ title="Mixtral 8x7b Chat",
48
+ retry_btn=None,
49
+ undo_btn=None
50
+ )
 
51
 
52
+ demo.queue().launch(show_api=True)
 
53