Spaces:
Build error
Build error
Tobias Geisler commited on
Commit ·
727bb86
1
Parent(s): 168235c
update to gpt-4o-mini, rename app to demo for compatibility
Browse files- app.py +5 -5
- tabs/create_chatbot.py +0 -3
- utils/openai_utils.py +1 -1
app.py
CHANGED
|
@@ -18,7 +18,7 @@ def create_app():
|
|
| 18 |
}
|
| 19 |
</script>
|
| 20 |
"""
|
| 21 |
-
) as
|
| 22 |
gr.Markdown("# codora KI-App-Ersteller v0")
|
| 23 |
|
| 24 |
with gr.Tabs():
|
|
@@ -31,7 +31,7 @@ def create_app():
|
|
| 31 |
with gr.Tab("Admin"):
|
| 32 |
create_admin_tab()
|
| 33 |
|
| 34 |
-
@
|
| 35 |
def load_chatbot_on_start(chatbot_id, request: gr.Request):
|
| 36 |
params = request.query_params
|
| 37 |
if "chatbot_id" in params:
|
|
@@ -51,9 +51,9 @@ def create_app():
|
|
| 51 |
outputs=[chat_tab['title'], chat_tab['chatbot_id_input'], chat_tab['share_link'], chat_tab['load_message']]
|
| 52 |
)
|
| 53 |
|
| 54 |
-
return
|
| 55 |
|
| 56 |
-
|
| 57 |
|
| 58 |
if __name__ == "__main__":
|
| 59 |
-
|
|
|
|
| 18 |
}
|
| 19 |
</script>
|
| 20 |
"""
|
| 21 |
+
) as demo:
|
| 22 |
gr.Markdown("# codora KI-App-Ersteller v0")
|
| 23 |
|
| 24 |
with gr.Tabs():
|
|
|
|
| 31 |
with gr.Tab("Admin"):
|
| 32 |
create_admin_tab()
|
| 33 |
|
| 34 |
+
@demo.load(inputs=[chat_tab['chatbot_id_input']], outputs=[chat_tab['title'], chat_tab['chatbot_id_input'], chat_tab['share_link'], chat_tab['load_message']])
|
| 35 |
def load_chatbot_on_start(chatbot_id, request: gr.Request):
|
| 36 |
params = request.query_params
|
| 37 |
if "chatbot_id" in params:
|
|
|
|
| 51 |
outputs=[chat_tab['title'], chat_tab['chatbot_id_input'], chat_tab['share_link'], chat_tab['load_message']]
|
| 52 |
)
|
| 53 |
|
| 54 |
+
return demo
|
| 55 |
|
| 56 |
+
demo = create_app()
|
| 57 |
|
| 58 |
if __name__ == "__main__":
|
| 59 |
+
demo.launch()
|
tabs/create_chatbot.py
CHANGED
|
@@ -30,9 +30,6 @@ def create_chatbot_tab():
|
|
| 30 |
copy_id_button = gr.HTML("""
|
| 31 |
<button onclick="copyToClipboard('created_chatbot_id')">Chatbot-ID kopieren</button>
|
| 32 |
""")
|
| 33 |
-
copy_name_button = gr.HTML("""
|
| 34 |
-
<button onclick="copyToClipboard('created_chatbot_name')">Chatbot-Name kopieren</button>
|
| 35 |
-
""")
|
| 36 |
|
| 37 |
create_button.click(
|
| 38 |
create_chatbot_interface,
|
|
|
|
| 30 |
copy_id_button = gr.HTML("""
|
| 31 |
<button onclick="copyToClipboard('created_chatbot_id')">Chatbot-ID kopieren</button>
|
| 32 |
""")
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
create_button.click(
|
| 35 |
create_chatbot_interface,
|
utils/openai_utils.py
CHANGED
|
@@ -19,7 +19,7 @@ def chat_with_bot(message, history, chatbot_id):
|
|
| 19 |
conversation.append({"role": "user", "content": message})
|
| 20 |
|
| 21 |
try:
|
| 22 |
-
response = client.chat.completions.create(model="gpt-
|
| 23 |
messages=conversation)
|
| 24 |
return response.choices[0].message.content
|
| 25 |
except Exception as e:
|
|
|
|
| 19 |
conversation.append({"role": "user", "content": message})
|
| 20 |
|
| 21 |
try:
|
| 22 |
+
response = client.chat.completions.create(model="gpt-4o-mini",
|
| 23 |
messages=conversation)
|
| 24 |
return response.choices[0].message.content
|
| 25 |
except Exception as e:
|