Spaces:
Build error
Build error
Update LLM model
Browse files
app.py
CHANGED
|
@@ -10,8 +10,6 @@ import base64
|
|
| 10 |
with open("Iso_Logotipo_Ceibal.png", "rb") as image_file:
|
| 11 |
encoded_image = base64.b64encode(image_file.read()).decode()
|
| 12 |
|
| 13 |
-
|
| 14 |
-
|
| 15 |
# chatbot = pipeline(model="microsoft/DialoGPT-medium")
|
| 16 |
# conversation = Conversation("Hi")
|
| 17 |
# response = chatbot(conversation)
|
|
@@ -56,8 +54,6 @@ def add_new_message(message,chat_history):
|
|
| 56 |
new_chat.append({"role": "user","content":message})
|
| 57 |
return new_chat
|
| 58 |
|
| 59 |
-
|
| 60 |
-
|
| 61 |
def respond(message, chat_history):
|
| 62 |
prompt = add_new_message(message, chat_history)
|
| 63 |
# stream = client.generate_stream(prompt,
|
|
@@ -67,7 +63,7 @@ def respond(message, chat_history):
|
|
| 67 |
# #stop_sequences to not generate the user answer
|
| 68 |
# acc_text = ""
|
| 69 |
response = openai.ChatCompletion.create(
|
| 70 |
-
model="gpt-
|
| 71 |
messages= prompt,
|
| 72 |
temperature=0.5,
|
| 73 |
max_tokens=1000,
|
|
@@ -105,7 +101,7 @@ with gr.Blocks() as demo:
|
|
| 105 |
</h1>
|
| 106 |
<img src='data:image/jpg;base64,{}' width=200px>
|
| 107 |
<h3>
|
| 108 |
-
|
| 109 |
</h3>
|
| 110 |
</center>
|
| 111 |
""".format(encoded_image))
|
|
@@ -119,9 +115,6 @@ with gr.Blocks() as demo:
|
|
| 119 |
btn = gr.Button("Enviar")
|
| 120 |
clear = gr.ClearButton(components=[msg, chatbot], value="Borrar chat")
|
| 121 |
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
btn.click(respond, inputs=[msg, chatbot], outputs=[msg, chatbot])
|
| 126 |
msg.submit(respond, inputs=[msg, chatbot], outputs=[msg, chatbot]) #Press enter to submit
|
| 127 |
clear.click(clear_chat,inputs=[msg, chatbot], outputs=[msg, chatbot])
|
|
|
|
| 10 |
with open("Iso_Logotipo_Ceibal.png", "rb") as image_file:
|
| 11 |
encoded_image = base64.b64encode(image_file.read()).decode()
|
| 12 |
|
|
|
|
|
|
|
| 13 |
# chatbot = pipeline(model="microsoft/DialoGPT-medium")
|
| 14 |
# conversation = Conversation("Hi")
|
| 15 |
# response = chatbot(conversation)
|
|
|
|
| 54 |
new_chat.append({"role": "user","content":message})
|
| 55 |
return new_chat
|
| 56 |
|
|
|
|
|
|
|
| 57 |
def respond(message, chat_history):
|
| 58 |
prompt = add_new_message(message, chat_history)
|
| 59 |
# stream = client.generate_stream(prompt,
|
|
|
|
| 63 |
# #stop_sequences to not generate the user answer
|
| 64 |
# acc_text = ""
|
| 65 |
response = openai.ChatCompletion.create(
|
| 66 |
+
model="gpt-4-1106-preview",
|
| 67 |
messages= prompt,
|
| 68 |
temperature=0.5,
|
| 69 |
max_tokens=1000,
|
|
|
|
| 101 |
</h1>
|
| 102 |
<img src='data:image/jpg;base64,{}' width=200px>
|
| 103 |
<h3>
|
| 104 |
+
En este espacio podr谩s interactuar con ChatGPT y su modelo GPT4!
|
| 105 |
</h3>
|
| 106 |
</center>
|
| 107 |
""".format(encoded_image))
|
|
|
|
| 115 |
btn = gr.Button("Enviar")
|
| 116 |
clear = gr.ClearButton(components=[msg, chatbot], value="Borrar chat")
|
| 117 |
|
|
|
|
|
|
|
|
|
|
| 118 |
btn.click(respond, inputs=[msg, chatbot], outputs=[msg, chatbot])
|
| 119 |
msg.submit(respond, inputs=[msg, chatbot], outputs=[msg, chatbot]) #Press enter to submit
|
| 120 |
clear.click(clear_chat,inputs=[msg, chatbot], outputs=[msg, chatbot])
|