Spaces:
Sleeping
Sleeping
Download app.py from Precieuxokit23/OKITAKOY-AI: direct link, hf CLI and curl.
- Browser
- Download file 751 Bytes
-
https://huggingface.co/spaces/Precieuxokit23/OKITAKOY-AI/resolve/refs%2Fpr%2F1/app.py
- Command line
-
hf download hf://spaces/Precieuxokit23/OKITAKOY-AI@refs/pr/1/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Precieuxokit23/OKITAKOY-AI/resolve/refs%2Fpr%2F1/app.py
751 Bytes
| import os | |
| import gradio as gr | |
| import openai | |
| openai.api_key = os.getenv("GROQ_API_KEY") | |
| openai.api_base = "https://api.groq.com/openai/v1" | |
| def ask_okitakoy(prompt): | |
| try: | |
| response = openai.chat.completions.create( | |
| model="mixtral-8x7b-32768", | |
| messages=[{"role": "user", "content": prompt}] | |
| ) | |
| return response.choices[0].message.content | |
| except Exception as e: | |
| return f"Erreur : {str(e)}" | |
| iface = gr.Interface( | |
| fn=ask_okitakoy, | |
| inputs=gr.Textbox(placeholder="Pose ta question à Okitakoy...", lines=2), | |
| outputs="text", | |
| title="Okitakoy - Mon Assistant IA (via Groq)", | |
| description="Assistant IA rapide, gratuit et intelligent basé sur Mixtral via Groq." | |
| ) | |
| iface.launch() |