import os import gradio as gr from groq import Groq client = Groq(api_key=os.getenv('GROQ_API_KEY')) def autocomplete(text): if text != "": response = client.chat.completions.create( model='gemma-7b-it', messages=[ { "role": "user", "content": text }], stream=True ) partial_message = "" for chunk in response: if chunk.choices[0].delta.content is not None: partial_message = partial_message + chunk.choices[0].delta.content yield partial_message css = """ body { --color-bg-primary: #f8fafc; /* secondary_50 als Hintergrundfarbe */ --color-text-primary: #65858b; /* secondary_500 als Textfarbe */ --color-text-secondary: #48626a; /* secondary_600 für sekundären Text */ --color-border: #1d343a; /* secondary_800 für Grenzen und Linien */ --color-button-bg: #cbd5e1; /* secondary_300 für Button-Hintergrund */ --color-button-hover-bg: #94adb8; /* secondary_400 für Button-Hover-Hintergrund */ --color-button-text: #0f2029; /* secondary_900 für Button-Text */ font-family: Arial, sans-serif; } .generating { display: none; } """ theme = 'syddharth/gray-minimal' # Erstelle die Gradio-Schnittstelle iface = gr.Interface( fn=autocomplete, inputs=gr.Textbox(lines=2, placeholder="Hallo 👋", label="Frag mich"), outputs=gr.Markdown(), title="", description="", live=True, allow_flagging="never", css=css, theme=theme # Hier fügst du das Theme hinzu ) iface.dependencies[0]['show_progress'] = "hidden" iface.dependencies[2]['show_progress'] = "hidden" # Starte die Anwendung iface.launch()