Spaces:
Sleeping
Sleeping
Tim Seufert
commited on
Commit
·
c6ff117
1
Parent(s):
a4eb314
backupdate
Browse files
app.py
CHANGED
@@ -18,19 +18,13 @@ api_key = os.environ.get("apikeysimple")
|
|
18 |
# Client außerhalb der Funktion initialisieren
|
19 |
co = cohere.Client(api_key=api_key)
|
20 |
|
21 |
-
def respond(message,
|
22 |
"""Einfache Antwortfunktion für das Gradio-Chatinterface"""
|
23 |
try:
|
24 |
-
#Bildverarbeitung
|
25 |
-
image_context = ""
|
26 |
-
if image is not None:
|
27 |
-
image_context = "\nEin Bild wurde Hochgeladen."
|
28 |
-
|
29 |
|
30 |
-
# Chat stream erstellen
|
31 |
stream = co.chat_stream(
|
32 |
-
model='
|
33 |
-
message=f"{prompt} '{message}'
|
34 |
temperature=0.3,
|
35 |
chat_history=[], # Consider using chat_history for context
|
36 |
prompt_truncation='AUTO',
|
@@ -63,17 +57,6 @@ demo = gr.ChatInterface(
|
|
63 |
#description2="SimplestMachine hat keinen Zugriff auf echtzeitinformationen. AI kann fehler machen.",
|
64 |
)
|
65 |
|
66 |
-
#Gradio Interface für Bildverarbeitung
|
67 |
-
with gr.Blocks() as demo:
|
68 |
-
chatbot = gr.Chatbot()
|
69 |
-
with gr.Row():
|
70 |
-
txt = gr.Textbox(show_label=False, placeholder="Stellen Sie Ihre Frage...")
|
71 |
-
img = gr.Image(type="filepath", label="Bittw Bild hochladen oder Aufnehmen")
|
72 |
-
|
73 |
-
txt.submit(respond, [txt, img, chatbot], [chatbot])
|
74 |
-
clear = gr.ClearButton(txt, img, chatbot)
|
75 |
-
|
76 |
-
|
77 |
# Anwendung starten
|
78 |
if __name__ == "__main__":
|
79 |
demo.launch(
|
|
|
18 |
# Client außerhalb der Funktion initialisieren
|
19 |
co = cohere.Client(api_key=api_key)
|
20 |
|
21 |
+
def respond(message, history):
|
22 |
"""Einfache Antwortfunktion für das Gradio-Chatinterface"""
|
23 |
try:
|
|
|
|
|
|
|
|
|
|
|
24 |
|
|
|
25 |
stream = co.chat_stream(
|
26 |
+
model='command-r-plus-08-2024',
|
27 |
+
message=f"{prompt} '{message}'",
|
28 |
temperature=0.3,
|
29 |
chat_history=[], # Consider using chat_history for context
|
30 |
prompt_truncation='AUTO',
|
|
|
57 |
#description2="SimplestMachine hat keinen Zugriff auf echtzeitinformationen. AI kann fehler machen.",
|
58 |
)
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
# Anwendung starten
|
61 |
if __name__ == "__main__":
|
62 |
demo.launch(
|